hope hope - 2 years ago 126
SQL Question

How to insert Image to database from picturebox

I have a

and I want to save its picture in a SQL Server database into a

Answer Source

I didnt exactly get what you meant but here is a piece of code you can use for inserting an image into database from picture box.

Image img = picturebox1.Image();
byte[] arr;
ImageConverter converter = new ImageConverter();
arr=(byte[])converter.ConvertTo(img, typeof(byte[]));

command.CommandText = "INSERT INTO ImagesTable (Image) VALUES('" + arr +    "')";
command.CommandType = CommandType.Text;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download