I’ve tried a lot to find that how can I load an image from SQL Server to picture box but I couldn’t find very much helpful material.
First I saved image into the data-base with the help of following query:
insert into imageTest (pic_id, pic)
values(1, 'D:\11.jpg')
Now I want to load the image into a picture box.
You never uploaded the image contents to the database. That’s just the file name.
Say, as an example, that you have a file path to work with (it seems you do, given the question’s contents). In your application, you would upload this to the database following this format:
Please bear in mind that your
picfield will more than likely need to change data type. A common type for this information isVARBINARY.The next part is reading the file into a PictureBox. For this, you’ll need to SELECT the data out:
And that should be about it. You might want to do better safety checks, but this should help you get started.