• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 595
  • Last Modified:

Retrieving Image data type and converting to string

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
kmhs
Asked:
kmhs
1 Solution
 
sybeCommented:
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
 
kmhsAuthor Commented:
Thanks for the help!
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now