How will picturebox1 winforms controls exist in the picture (image), deposit (upload) to the database specified in the specified field in the table (img2), img1 can be null, pay attention to the picture is not being loaded in from a computer file path of images, but has been shown in the pictures in the picturebox1 (remember),
In the database table style below
The CREATE TABLE [dbo] [tupian] (
[id]/int IDENTITY (1, 1) NOT NULL,
[img1] [image] NULL
[img2] [image] NULL
)
Id and img2 here is to insert the value of the id of the value is comes from the winform label7 in text content (digital),
Img2 is picturebox1. Image image

CodePudding user response:
https://www.cnblogs.com/ingstyle/p/6655981.htmlFrom picture box instead of image read from the file, modify the code:
MemoryStream MemoryStream=new MemoryStream ();
Enclosing pictureBox1. Image. Save (memoryStream, ImageFormat. Jpeg);
Byte [] imgBytesIn=memoryStream. ToArray ();