how to retrieve images in vb.et

Posted by Shanky11 under VB.NET on 3/5/2013 | Points: 10 | Views : 1202 | Status : [Member] | Replies : 2
how to retrieve images in vb.net.....................................this code is for saving images


Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim sql As String = "INSERT INTO advertisement VALUES(@advertisement)"
con = New SqlConnection("data source=I3-001\SQL2008R2; initial catalog=SmsDb; user id=sa; password=bss123")
con.Open()
Dim query = "insert into advertisement(advertisement) values(@advertisement)"
cmd1 = New SqlCommand(query, con)
Dim ms As New MemoryStream()
PictureBox1.BackgroundImage.Save(ms, PictureBox1.BackgroundImage.RawFormat)
Dim data As Byte() = ms.GetBuffer()
Dim p As New SqlParameter("@advertisement", SqlDbType.Image)
p.Value = data
cmd1.Parameters.Add(p)
cmd1.ExecuteNonQuery()
con.Close()
End Sub




Responses

Posted by: Satyapriyanayak on: 3/5/2013 [Member] [MVP] Silver | Points: 25

Up
0
Down
http://www.codeproject.com/Articles/437937/Save-and-Retrieve-Image-from-a-SQL-Server-Database

If this post helps you mark it as answer
Thanks

Shanky11, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Santhi on: 3/5/2013 [Member] Starter | Points: 25

Up
0
Down
Hi

Refer this link:
http://www.aspdotnet-suresh.com/2011/01/how-to-insert-images-into-database-and.html

Thanks & Regards,
Santhi .V

Shanky11, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response