I wanna know how to retrieve & insert an image from/to a Sql Server database.
usingimage control or any other control
I've done that with windows formpicture box.
As that was explained in MS tutorials
Code….
--------------
Dim msAsNew MemoryStreamPictureBox1.Image.Save(ms, PictureBox1.Image.RawFormat)Dim arrImage()AsByte = ms.GetBufferms.Close()
Dim strSQLAsString = _ "INSERT INTO Emp (EmpName,EmpSalary,Picture)" & _ "VALUES (@.EmpName,@.EmpSalary,@.Picture)" Dim cmdAsNew SqlCommand(strSQL, ConnEmp) With cmd .Parameters.Add(New SqlParameter("@.Picture", _ SqlDbType.Image)).Value = arrImage .Parameters.Add(New SqlParameter("@.EmpName", _ SqlDbType.NVarChar)).Value = txtEmpName.Text .Parameters.Add(New SqlParameter("@.EmpSalary", _ SqlDbType.Decimal)).Value = txtEmpSalary.Text EndWithcmd.ExecuteNonQuery()
--------------
But with a web form'simage control IDO NOTknow how to do it
I real appreciate your help
Thank you
Here's an article on it:http://aspalliance.com/articleViewer.aspx?aId=140
Hope this helps...
-Damien
No comments:
Post a Comment