I have to save 4 different pictures in my database. NSO, GoodMoral, ReportCard & TOR.
Here is my code.
Sub savepic()
Dim str As String = "My connection"
Dim con As New SqlClient.SqlConnection
con.ConnectionString = str
Dim ms As New IO.MemoryStream()
nsopic.Image.Save(ms, nsopic.Image.RawFormat)
goodmoralpic.Image.Save(ms, goodmoralpic.Image.RawFormat)
repcardpic.Image.Save(ms, repcardpic.Image.RawFormat)
torpic.Image.Save(ms, torpic.Image.RawFormat)
Dim arrimage() As Byte = ms.GetBuffer
Dim cmd As New SqlCommand("insert into store_image_requirements (NSOBirthC,ReportCard,GoodMoral,TOR,Student_No,Surname,First_Name,Middle_Name)values(@picture1,@picture2,@picture3,@picture4, '" & txtstud_no.Text & "', '" & txtsurname.Text & "', '" & txtfirstname.Text & "', '" & txtmiddlename.Text & "')", con)
cmd.Parameters.Add(New SqlParameter("@picture", SqlDbType.Image)).Value = arrimage
con.Open()
cmd.ExecuteNonQuery()
con.Close()
My problem is, it allows me to look for different picture then save it without error. But when I check on the database(MSSQL) it doesn't save the different pictures but one picture for all four requirements (NSO, GoodMoral, ReportCard & TOR). How can I be able to save multiple images in my database? Please help. Thank You