Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hi I need to change a JPG to BYT

Status
Not open for further replies.

KatiS

Programmer
Apr 29, 2019
2
GB
Hi

I need to change a JPG to BYTE and insert it to SQL database.
I used a function to read the JPG and change it to BYTE using oStream.Read

bData = oStream.Read

Now I need to send this value to my storedprocedure. I need to create a text command like this

l_SQL = " exec dbo.sp_Custom_UpdateAnagpersPhoto " & bData

I get type mismatch.

Would you please tell me ?

Thank you
Kati
 
I think you need to convert the bytearray into a string first
this function may be what you need
Code:
Function Byte2String(s)
    Dim i
    For i = 1 to LenB(s)
        Byte2String = Byte2String & CHR(AscB(MidB(s,i,1)))
    Next
End Function
pass the byte array into the function and then read the return into a string, pass that string into your stored proc
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top