Как Сохранить картинку (например 111.bmp) в базу данных base.mdb
через объект data. А потом можно было вытащить ее в Image?
Подскажите если не трудно.
Private Sub AppendImage(ByVal FullFileName As String)
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
'-------
Dim aData() As Byte
Dim iFF As Long
iFF = FreeFile()
Open FullFileName For Binary As #iFF
ReDim aData(0 To LOF(iFF) - 1)
Get #iFF, , aData()
Close #iFF
Set cn = New ADODB.Connection
cn.Open <ConnectionString>
Set rs = New ADODB.Recordset
rs.Open "table_name", cn, adOpenDynamic, adLockPessimistic
rs.AddNew
rs("field_name").AppendChunk aData()
rs.Update
rs.Close
cn.Close
Set rs = Nothing
Set cn = Nothing
Erase aData()
End Sub
Private Sub ExtractImage(ByVal FullFileName As String)
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
'-------
Dim aData() As Byte
Dim iFF As Long
Set cn = New ADODB.Connection
cn.Open <ConnectionString>
Set rs = New ADODB.Recordset
rs.Open "sql_query", cn, adOpenForwardOnly, adLockReadOnly
With rs("field_name")
aData = .GetChunk(.ActualSize)
End With
rs.Close
cn.Close
Set rs = Nothing
Set cn = Nothing
iFF = FreeFile()
Open FullFileName For Binary As #iFF
Put #iFF, , aData()
Close #iFF
Erase aData()
End Sub
Сейчас этот форум просматривают: нет зарегистрированных пользователей и гости: 220