Hello again! So now i can save the picture in the database, now i have to retrieve it.
this is my code for the saving of the picture,
Dim ms As New MemoryStream()
studentpic.Image.Save(ms, studentpic.Image.RawFormat)
Dim arrImage() As Byte = ms.GetBuffer
ms.Close()
Dim strFilename As String = lblfilePath.Text.Substring(lblfilePath.Text.LastIndexOf("\"))
Dim cnn As New SqlConnection(connectionString:="data source=.\sqlexpress; integrated security=true; attachdbfilename=|datadirectory|\WAIS.mdf; user instance=true;")
Dim strSQL As String = "INSERT INTO ImagesStore (OriginalPath, ImageData)" & "VALUES (@OriginalPath, @ImageData)"
Dim cmd As New SqlCommand(strSQL, cnn)
With cmd
.Parameters.Add(New SqlParameter("@OriginalPath", SqlDbType.NVarChar, 50)).Value = strFilename
.Parameters.Add(New SqlParameter("@ImageData", SqlDbType.Image)).Value = arrImage
End With
cnn.Open()
cmd.ExecuteNonQuery()
cnn.Close()
i saw on the net that i have to the reverse of the pic, i have to convert byte into image. can you please help me. thank you