![]() I was getting the parameter not valid error as well. ![]() PictureBox1.Image = Image.FromStream(stmBLOBData) cmd.CommandText = "select imagedate from projectimages where imagename = '" ListBox1.Text "' and CSVprojectref=checksum('" textboxFileRef.Text "')"ĭim c As Integer = ds.Tables(0).Rows.Countĭim stmBLOBData As New MemoryStream(bytBLOBData) ' Dim cmd As New SqlCommand("insert projectimages(imagename,imagedate,csvprojectref) values('imagma','" img "',CHECKSUM('" textboxFileRef.Text "'))", con)Īnd when to retrieve data to insert into picture box use this code. ![]() 'Dim cmd As New SqlCommand("INSERT INTO projectimages (imagename,imagedate,csvprojectref) VALUES ('" imageFilename textboxFileRef.Text "'))", con)ĭim cmd As New SqlCommand("INSERT INTO projectimages (imagename,imagedate,csvprojectref) VALUES ('" imageNameTemp textboxFileRef.Text "'))", SqlDbType.Image, b.Length).Value = b ImageNameTemp = imageNameTemp.Remove(0, imageNameTemp.IndexOf("\") 1) ImageUpload = Image.FromFile(OpenFileDialog1.FileName) Now add this code when storing image to the sql database OpenFileDialog1.ShowDialog() ImageUpload.Save(ms, .Bmp)ĭim img As String = Convert.ToBase64String(bytes)ĭim cmd As New OleDb.OleDbCommand("insert projectimages values('" imageNameTemp "','" img "',CHECKSUM('" textboxFileRef.Text "'))", con)Īfter 5-6 hours of searching forums and blogs and everything i fond this. If imageFilename.Contains("jpeg") Or imageFilename.Contains("jpg") Then The datatype is Image in sql database and i use this code to save image to db Dim ms As New IO.MemoryStream I am having a lot of trouble retrieving the image and displaying it in the PictureBox. Now how can I add this to PictureBox.image. ListBox1.Text "' and CSVprojectref=checksum('" textboxFileRef.Text "')" I am using this to get image bytes from the database cmd.CommandText = "select imagedate from projectimages where imagename = '" _
0 Comments
Leave a Reply. |