byte[] imgbyte = FileUpload1.FileBytes;
SqlConnection connection = new SqlConnection("Type Connection String Here");
SqlCommand command = new SqlCommand("INSERT INTO Table_Image(Name,Image) VALUES (@name,@image)", connection );
connection .Open();
command .Parameters.AddWithValue("@name", TextBox1.Text);
SqlParameter img = new SqlParameter("@image", SqlDbType.Image, imgbyte.Length);
img.Value = imgbyte;
command .Parameters.Add(img);
command .ExecuteNonQuery();
connection .Close();
SqlConnection connection = new SqlConnection("Type Connection String Here");
SqlCommand command = new SqlCommand("INSERT INTO Table_Image(Name,Image) VALUES (@name,@image)", connection );
connection .Open();
command .Parameters.AddWithValue("@name", TextBox1.Text);
SqlParameter img = new SqlParameter("@image", SqlDbType.Image, imgbyte.Length);
img.Value = imgbyte;
command .Parameters.Add(img);
command .ExecuteNonQuery();
connection .Close();
No comments:
Post a Comment