i am trying to use ADODB.Stream object to read an image file into a byte array. then i want to take that byte array and convert it to a hex value and pass it to a SQL Server stored procedure that takes it as a parameter and writes it to an IMAGE field in a table.

here's what I have so far:

Private Sub Form_Load()
   Dim adoStream As ADODB.Stream, _
       con As ADODB.Connection, _
       rs As ADODB.Recordset, _
       o() As Byte
   Set adoStream = New ADODB.Stream
   adoStream.Type = adTypeBinary
   adoStream.LoadFromFile "c:\tmp\test.bmp"
   Set con = New ADODB.Connection
   con.Open "Provider=SQLOLEDB.1;Integrated Security=SSPI;Initial Catalog=TEST1;Data Source=L6064909"
   o = adoStream.Read
   con.Execute ("exec sp_AddImage " & Byte2Hex(o))
End Sub
the problem is with Byte2Hex function. there i have to loop through every element of the o() and use a Hex() function on each. i guess the question is: can i convert my byte array to hex in one shot, without converting each element?

a secondary question is: is there a better way of doing this? i really don't want to use rs.AddNew...rs.Update

i tried to bypass storing the image to the byte array and just call Read method at the time of executing the sp, but vb complained about the question marks.

any thoughts, suggestions?

thanks in advance.