How to save image in Ms-SQL Database using VB.NET?

Visit Publisher Site
How to save image in Ms-SQL Database using VB.NET? Hosting Promo

Sponsored by TMDHosting

Dim connstring As String Dim sql As String Dim sqlcon As New SqlConnection Private Sub SaveImage_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveImage.Click OpenFileDialog1.ShowDialog() If OpenFileDialog1.FileName.Length > 0 Then connstring = âData Source=localhost;Initial Catalog=Test;User id=username;password=password;â sqlcon.ConnectionString = connstring sqlcon.Open() Dim imgByte As Byte() = Nothing imgByte = IO.File.ReadAllBytes(OpenFileDialog1.FileName) Dim sql As String = âINSERT INTO Image_Test(FieldName, FieldImage) VALUES(@parameter1, @parameter2)â Dim cmd As SqlCommand = New SqlCommand(sql, sqlcon) cmd.Parameters.AddWithValue(â@parameter1â³, âTestValueâ) cmd.Parameters.AddWithValue(â@parameter2â³, imgByte) cmd.ExecuteNonQuery() sqlcon.Close() End If End Sub

Visit publisher site: How to save image in Ms-SQL Database using VB.NET?

Listing Details

Filed in:
Scripts / ASP.NET / Tutorials & Tips
Submitted on:
Last Updated:
Jan 19, 2013 
Other listings by this publisher

License & Pricing Information

License Type:
$0.00 USD
Additional Info:

User Reviews 

Be the first to review this listing!