how can i write program with c# that show picture from sql server.?how can i store picture in sql server.?thank you | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

how can i write program with c# that show picture from sql server.?how can i store picture in sql server.?thank you

save picture in sql server

7th Jun 2017, 9:43 PM
Ali Musavi
Ali Musavi - avatar
8 Answers
+ 3
Yes, I think you can use database storing for this purpose.
8th Jun 2017, 9:10 AM
Aibek T.
Aibek T. - avatar
+ 2
If you use MS SQL Server you can use a field of varbinary(max) type to store your images. But sometimes it is a better idea not to store images themselves in database, especially if the size of a file is more than 250K. Rather than that you can store your images in your application folder, e.g. ...\AppFolder\images\, and have the full paths or just filenames of images in a usual varchar field in database.
7th Jun 2017, 10:29 PM
Aibek T.
Aibek T. - avatar
+ 2
It depends on concrete case. If you want to use in your application small thumb sized pictures it is OK and even more practical to store them in database. This way you can bind them to a column in datagridview or to picturebox etc. These might be small sized pictures of employees for example. But if you want to do some image processing software which works with large amount of images than probably it is better to store them in folders?
8th Jun 2017, 8:10 AM
Aibek T.
Aibek T. - avatar
+ 2
If you can not find varbinary type in your DBMS look either for image or binary or blob type.. all of these can store images and files. I found this sample tutorial about how to use images from database in winforms app: http://www.redmondpie.com/inserting-in-and-retrieving-image-from-sql-server-database-using-c/ I hope this can help you get started.
8th Jun 2017, 4:32 PM
Aibek T.
Aibek T. - avatar
+ 1
thank you so much.yes i want just show me picture not processing.i want to create a program for my office that when programize my document,when click on that document show me picture of that
8th Jun 2017, 8:33 AM
Ali Musavi
Ali Musavi - avatar
+ 1
thank you very much.
8th Jun 2017, 4:51 PM
Ali Musavi
Ali Musavi - avatar
0
your mean is not using sql and use directly from software?
8th Jun 2017, 4:27 AM
Ali Musavi
Ali Musavi - avatar
0
how could i do? there is no field in sql that store picture .in fact i dont know how store picture and get from that
8th Jun 2017, 1:19 PM
Ali Musavi
Ali Musavi - avatar