Click here to Skip to main content
15,888,351 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I am developing a project in C#.net(window application), And i want to store n retrieve image into database(SQL Server 2008 R2).
If any1 have any idea plz share....
Thanx in advance.....
Posted
Comments
Prasad Khandekar 26-Apr-13 2:05am    
Hello Gaurav,

You can find many article on this very site. Just search for it.
1. http://www.codeproject.com/Articles/437937/Save-and-Retrieve-Image-from-a-SQL-Server-Database
2. http://www.codeproject.com/Articles/9686/Save-An-Image-Into-SQL-Server-2000-Database
3. http://www.codeproject.com/Articles/7246/Display-Images-from-Database-in-ASP
4. http://www.codeproject.com/Articles/33310/C-Save-and-Load-Image-from-Database
5. http://www.codeproject.com/Tips/244209/Loading-an-Image-and-Saving-it-into-a-database
Gaurav Jadhav 26-Apr-13 3:09am    
hello Prasad,
the links are not helpfull.... plz if you have any code post it....
[no name] 26-Apr-13 13:31pm    
Why are the articles not helpful? They answer your question so what is the problem exactly?

1 solution

There are at least 2 solutions for you:

1. Save the paths to your images as string, this is simple and of course popularly used.

2. Using Serialization to turn your images to byte[] then save these bytes into your database (with type of binary or image). Wanna code? No code here, this is too easy, just 3-4 lines of code for saving and 3-4 lines of code for loading. (I've found this using Bing, not Google, so I say I binged it, try it yourself)
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900