i have problem in retrieving picture in picturebox
i have a dataset named "DS" and i have built memberPhotoTableAdapter in it.
i call the MemberPhotoTableAdapter in form load by this code:
this is the codes to insert picture in database :
Private Sub btnSavePic_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSvePic.Click
Dim ms As New MemoryStream()
Dim arrPic As Byte() = ms.GetBuffer()
Catch ex As Exception
this code works well,but for retrieving the picture i have problem.
this is the code for retrieving picture in form_Load:
Dim arrPic As Byte()
arrPic = DirectCast(DS.Tables("MembersPhoto").Rows(0)("pic"),Byte())
Dim ms As MemoryStream = New MemoryStream(arrPic)
Photo.Image = New Bitmap(ms)
i know that the bold line is wrong and in running time shows error, for the persons that i have inserted picture for them before, shows this error:
error: the parameter is not valid
and for the persons without picture showes this error:
error : there is no row in position 0.
but what shuold i write insted of that