How to retreive an image from database
i want to retrieive the photo of employees stored in table employees
of Northeind database.
I have 4 buttons(First,Next,Previous,Last) and one PictureBox on the
form.
Coding of the Last button is as follows:
Dim bm As BindingManagerBase
bm = Me.BindingContext(DsEmployees1, "employees")
bm.Position = bm.Count - 1
Dim c As Integer = DsEmployees1.Tables("employees").Rows.Count
Dim ctr As Integer = DsEmployees1.Tables(0).Rows.Count - 1
Dim bytEmpPhoto() As Byte =
DsEmployees1.Tables("employees").Rows(ctr)("Photo" )
Dim stmEmpPhoto As New MemoryStream(bytEmpPhoto)
PictureBox1.Image = Image.FromStream(stmEmpPhoto)
This coding gives me an error:
'System.ArgumentException' occured.
Error: Invalid Parameter Used.
lovely
|