Answer the question
In order to leave comments, you need to log in
How to insert an image into the database?
In Visual Studio 2019, I created a .mdf database and I want to add a picture to my table, I added an image type column with what SQL query can I add a .png or .jpg picture there so that I can then load it into a PictureBox in my WinForms form?
Answer the question
In order to leave comments, you need to log in
OPENROWSET .
INSERT INTO myimages values (SELECT * FROM OPENROWSET(BULK 'C:\img\1.png', SINGLE_BLOB) as T1)
FromStream(Stream)
, namely Save(Stream, ImageFormat)
. With their help, they work with BLOB fields.
100500 times. You don't have to do that. Databases, especially relational, are not for this. Store pictures statically on the server, in files
What is the purpose of storing the image? Write down the path to it and the name in the format images / name.jpg and the picture itself in the folder
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question