Hello, I have a program that reads images from my access database. What I'm trying to do now is write the images out to a folder but I don't know where to begin. The "ms" variable holds the images.
Option Explicit On
Public Class Form1
Private cn As ADODB.Connection
Private rs As ADODB.Recordset
Dim RecCount As Integer
Dim test1
Dim test2
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
cn = New ADODB.Connection
cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\Users\Bao\Desktop\Capstone\db1.mdb"
cn.Open()
rs = New ADODB.Recordset
rs.Open("Select * FROM student", cn, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockBatchOptimistic, 1)
'MsgBox("Total Number of records = " & rs.RecordCount)
Do While Not rs.EOF
'MsgBox(rs.Fields("firstname").Value)
'MsgBox(rs.Fields("lastname").Value)
Dim [B]ms [/B]As New IO.MemoryStream(CType(rs.Fields("image").Value, Byte()))
'PictureBox1.Image.Save("C)
rs.MoveNext()
Loop
cn.Close()
End Sub
Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox1.Click
End Sub
End Class