i am developing a project so it involves working with picture.i have a code in vb6 that can retrieve image from the sql server,the code is this.And i need exact of such code that will be able to save into the DB,to avoid disparity in the binary conversion.
Dim CN As New ADODB.Connection
Dim RS As ADODB.Recordset
Dim DataFile As Integer, Fl As Long, Chunks As Integer
Dim Fragment As Integer, Chunk() As Byte, i As Integer, FileName As String
Private Const ChunkSize As Integer = 16384
Private Const conChunkSize = 100
Private Sub Form_Load()
CN.Open "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=Pubs;Data Source=Test"
Dim strsql As String
strsql = "SELECT * FROM pub_info where pub_id = '9999'"
RS.Open strsql, CN, adOpenForwardOnly, adLockReadOnly
ShowPic
Set RS = Nothing
Set RS = New Recordset
End Sub
Private Sub ShowPic()
DataFile = 1
Open "pictemp" For Binary Access Write As DataFile
Fl = RS!logo.ActualSize ' Length of data in file
If Fl = 0 Then Close DataFile: Exit Sub
Chunks = Fl \ ChunkSize
Fragment = Fl Mod ChunkSize
ReDim Chunk(Fragment)
Chunk() = RS!logo.GetChunk(Fragment)
Put DataFile, , Chunk()
For i = 1 To Chunks
ReDim Buffer(ChunkSize)
Chunk() = RS!logo.GetChunk(ChunkSize)
Put DataFile, , Chunk()
Next i
Close DataFile
FileName = "pictemp"
Picture1.Picture = LoadPicture(FileName)
End Sub
pls help