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
這個是寫的讀取圖片函式
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/243404.html
下一篇:角色、權限、授權
