How can I save an image to a SQL 7 database using ADO in VB? I've
got pulling the image out and saving it to disk down, now I need
to reverse that process. I need to read an image from disk and
store it in a SQL 7 table.

The current evolution of my failure looks like this:

Const mclChunkSize As Long = 1024& * 32& '32K Chunks (32768)

Open strTempFile For Binary As #iFN
lFileLen = LOF(iFN)

Set rs = New Recordset
rs.CursorLocation = adUseClient
rs.CursorType = adOpenDynamic
rs.LockType = adLockOptimistic

rs.Open strSQL, oConn
rs.Fields("image1").Value = ""

While lFileLen > 0 'loop until finished
If mclChunkSize < lFileLen Then
'chunk smaller than remaining
sChunk = String$(mclChunkSize, vbNullChar)
'chunk larger than remaining
sChunk = String$(lFileLen, vbNullChar)
End If
Get #iFN, , sChunk 'get a chunk
rs.Fields("image1").AppendChunk sChunk
lFileLen = lFileLen - mclChunkSize

Close #iFN


Please help, this is driving me insane.

"All tribal myths are true,
for a given definition of 'true'".
-Terry Pratchett