I have a DataGridView, which has a image column:
Update Button_Click:
Update query:
Then I'am converting the image, so that I can save it to my SQL-Server
I'm not getting any error after executing this. The image is saved as some black color:[IMG]
[/IMG]
Update Button_Click:
Code:
Dim dtimage As Image
{
using (MemoryStream ms = new MemoryStream(rv.Row.Field<byte[]>("empimage"))) {
dtimage = new Bitmap(ms);
}
}
Code:
adapter.UpdateCommand == new SqlCommand("update DepartmentMaster_tbl set dtName = @dtName,dtPhone = @dtPhone,dtEmail = @dtEmail,empimage=@dtimage where dtId=@dtid", con.connect)
Code:
MemoryStream md = new MemoryStream();
dtimage.Save(md, System.Drawing.Imaging.ImageFormat.Gif);
byte[] bmpBytes = md.GetBuffer();
adapter.UpdateCommand.Parameters.AddWithValue("@dtimage", bmpBytes);
adapter.UpdateCommand.ExecuteNonQuery();
[/IMG]