sql sever 2008中photo列是image类型,存的是二进制数据,现在想在vb6.0中通过image显示出图片,但总是提示我文件打开途径错误
Public Sub showimage(imagen As Image, adodcn As Adodc)
Dim bytechunk() As Byte
fieldsize = adodcn.Recordset.Fields("Photo").ActualSize
If fieldsize <= 0 Then
imagen.Picture = LoadPicture("")
Exit Sub
End If
sourcefile = FreeFile
Open tempfile For Binary Access Write As sourcefile
numblocks = fieldsize \ blocksize
leftover = fieldsize Mod blocksize
If leftover <> 0 Then
ReDim bytechunk(leftover) As Byte
bytechunk()=adodcn.Recordset.Fields("Photo").GetChunk(leftover)
Put sourcefile, , bytechunk()
End If
For i = 1 To numblocks
ReDim bytechunk(blocksize) As Byte
bytechunk() = adodcn.Recordset.Fields("Photo").GetChunk(blocksize)
Put sourcefile, , bytechunk()
Next i
Close sourcefile
imagen.Picture = LoadPicture(tempfile)
Kill (tempfile)
End Sub
错误停在open tempfile for binary access write as sourcefile
这个是写的读取图片函数