Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Retrieving Binary data from a database using ASP

Posted on 1998-08-27
4
Medium Priority
?
191 Views
Last Modified: 2013-12-25
I have information stored in a table with the coloumn set to binary data. What I need to know is how to retrieve it and print it on an ASP page. I have tried the response.BinaryWrite with no result. What should I do?
The binary data is URL encoded. Is there any funktion in ASp for URLDecoding?
0
Comment
Question by:MHQ
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 3

Author Comment

by:MHQ
ID: 1854587
I can extract almost all data using a simpe <% = database("text") %> It is still URL encoded though. And, for some reason, I ca'nt retrieve two of the fields.
0
 
LVL 3

Author Comment

by:MHQ
ID: 1854588
Don't bother about the two fields, found THAT error...
0
 
LVL 28

Accepted Solution

by:
sybe earned 280 total points
ID: 1854589
URLDecoding in ASP can be done. The following 2 functions each do the job:

<script language=JavaScript RUNAT=Server>
function JSUrlDecode(str) {
      return unescape(str):
}
</script>


<SCRIPT RUNAT=Server LANGUAGE="VBScript">
Function URLDecode(str)
   strInput = str
   If strInput = null Then strInput = ""
   ' First convert the + to space
   strOutput = REPLACE(strInput, "+", " ")
   ' Then convert the %number to normal code
   strSplit = Split(strOutput, "%")
   If ubound(strSplit) > 0 Then
      i = 0
      strOutput = strSplit(i)
      Do While i < ubound(strSplit)
         HexCode =  "&H" & Left(strSplit(i+1),2)
         Letter = CHR(HexCode)
         strOutput = strOutput & Letter & Right(strSplit(i+1),len(strSplit(i+1))-2)
         i = i + 1
      Loop
   End If
   URLDecode = strOutput
End Function
</SCRIPT>

<%
' Call the functions by:
NewString = URLDecode(OldString)
'or by
NewString = JSUrlDecode(OldString)
%>

By the way, urldecoded data should not be binary, it is normal text, using a minimal set of ASCII values.

0
 
LVL 3

Author Comment

by:MHQ
ID: 1854590
That did the trick. I apreciate the help!
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Although a lot of people devote their energy toward marketing for specific industries, there are some basic principles that can be applied to any sector imaginable. We’ll look at four steps to take and examine how those steps were put into action fo…
CTAs encourage people to do something specific to show interest in your company, product or service. Keep reading to learn why CTAs should always be thought of as extremely important, albeit small, sections of websites.
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.
Suggested Courses

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question