?
Solved

Retrieving Binary data from a database using ASP

Posted on 1998-08-27
4
Medium Priority
?
190 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

Get MySQL database support online, now!

At Percona’s web store you can order your MySQL database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card.

Question has a verified solution.

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

Color can increase conversions, create feelings of warmth or even incite people to get behind a cause. If you want your website to really impact site visitors, then it is vital to consider the impact color has on them.
Originally, this post was published on Monitis Blog, you can check it here . It goes without saying that technology has transformed society and the very nature of how we live, work, and communicate in ways that would’ve been incomprehensible 5 ye…
The viewer will learn how to count occurrences of each item in an array.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

752 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