?
Solved

Retrieving Image data type and converting to string

Posted on 2003-03-06
3
Medium Priority
?
594 Views
Last Modified: 2007-12-19
Hi.

I'm using ASP to extract data from Microsoft Project 2002 which uses SQL2000 as its back end.  In one particular table, inputted text is stored in a column with Image as the data type.  An entry will look something like this:

0x7B5C727466315C616E73695C616E7369637067313235325C64656666305C6465666C616E67313033337B5C666F6E7474626C7B5C66305C666D6F6465726E5C66636861727365743020436F7572696572204E65773B7D7B5C66315C6673776973735C66707271325C66636861727365743020417269616C3B7D7D0D0A7B5C2A

I'm using real simple code to extract the data:

               <TH>Task</TH>
               <TH>Notes</TH>
          </TR>
                                   
<%
          Dim rs
          Dim con
          Dim strCon
          Dim strSQL

         

          strSQL = "select msp_projects.proj_name, msp_tasks.Task_Name, msp_tasks.Task_rtf_Notes from msp_projects, msp_tasks WHERE msp_projects.PROJ_ID = msp_tasks.PROJ_ID and msp_tasks.PROJ_ID = " & Request.querystring("ProjID")

          strCon = "Driver={SQL SERVER}; server=SQL2000; uid=sa; pwd=portia; database=ProjectServer"
         
          Set con = Server.createObject("ADODB.Connection")
          con.cursorLocation = adUseClient
          con.open strCon
          Set rs = con.execute(strSQL)
          Do Until rs.EOF          
%>

          <TR>
               
               <TD><%=rs.fields(1).value%></TD>
               <TD><%=rs.fields(2).value%></TD>
               
          </TR>
<%
         
               rs.moveNext
          Loop
         
          rs.close
          con.close
          Set rs = Nothing
          Set con = Nothing

%>
     
          </table>

How do I convert the binary value into the string value?  Initially, the users only need to view the data.  I would like for them to be able to update these fields (I imagine I would have to convert the user-inputted data to binary).  Thanks for your help.

Keith
0
Comment
Question by:kmhs
[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 Comments
 
LVL 28

Accepted Solution

by:
sybe earned 400 total points
ID: 8084111
Function Byte2String(s)
    Dim i
    For i = 1 to LenB(s)
        Byte2String = Byte2String & CHR(AscB(MidB(s,i,1)))
    Next
End Function

Function String2Byte(s)
    Dim sChar, i
    For i = 1 to Len(s)
        sChar = Mid(s, i, 1)
        String2Byte = String2Byte & ChrB(Asc(sChar))
    Next
End Function



0
 

Author Comment

by:kmhs
ID: 8195727
Thanks for the help!
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

765 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