Using myConnection As New OleDbConnection(strConnection)
myConnection.Open()
Dim strSql As String = "SELECT PICTURE FROM MT_IMAGE"
Try
Using myCommand As New OleDbCommand(strSql, myConnection)
myCommand.CommandType = CommandType.Text
Using myDataReader As OleDbDataReader = myCommand.ExecuteReader()
myDataReader.Read()
Dim ImageBytes As Byte() = CType(myDataReader(0), Byte())
Dim ms As New MemoryStream(ImageBytes)
Dim img As Image = Image.FromStream(ms)
picShow.Image = img
End Using
End Using
Catch ex As Exception
MessageBox.Show(ex.Message, "Error")
End Try
End Using
Private dt As New DataTable
Private dr() As DataRow
Private intID As Byte = 0
Private Sub cmdLoad_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdLoad.Click
Using myConnection As New OleDbConnection(strConnection)
myConnection.Open()
Dim strSql As String = "SELECT PICTURE FROM MT_IMAGE"
Try
Using myCommand As New OleDbCommand(strSql, myConnection)
myCommand.CommandType = CommandType.Text
Using myDataReader As OleDbDataReader = myCommand.ExecuteReader()
dt.Load(myDataReader)
dr = dt.Select
Dim ImageBytes As Byte() = CType(dr(0)("PICTURE"), Byte())
Dim ms As New MemoryStream(ImageBytes)
Dim img As Image = Image.FromStream(ms)
picShow.Image = img
End Using
End Using
Catch ex As Exception
MessageBox.Show(ex.Message, "Error")
End Try
End Using
End Sub
Private Sub cmdNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdNext.Click
If Not (intID = dt.Rows.Count) Then
intID += 1
Dim ImageBytes As Byte() = CType(dr(intID)("PICTURE"), Byte())
Dim ms As New MemoryStream(ImageBytes)
Dim img As Image = Image.FromStream(ms)
picShow.Image = img
End If
End Sub