Click here to Skip to main content
14,599,518 members
Rate this:
Please Sign up or sign in to vote.
See more:
Hi !

I want to store a file (doc,pdf,...) in SQL Server 2005 database .
How to do it ?

Please send to me a sample code .

Thanks .
Posted
Rate this:
Please Sign up or sign in to vote.

Solution 4

follow the belowing link........
http://support.microsoft.com/default.aspx?scid=kb;en-us;317016

Edit: URL formatted.
   
v2
Rate this:
Please Sign up or sign in to vote.

Solution 3

You have two (or more, I don't know) options:
  • Store the whole file content as a binary object (BLOB) inside the database ('deep copy').
  • Store just the file path inside the database ('weak copy').
   
Comments
Pravin Patil, Mumbai 23-Aug-11 8:07am
   
My 5 for the most correct answer......
CPallini 23-Aug-11 8:10am
   
Thank you.
Yuri Vital 23-Aug-11 10:21am
   
Yes it's a good answer !!
walterhevedeich 23-Aug-11 21:38pm
   
Correct. My 5. Small files - deep copy. Large files - weak copy.
CPallini 24-Aug-11 3:15am
   
Thank you.
Rate this:
Please Sign up or sign in to vote.

Solution 2

See this answer. Images, files, all the same really. If you've got large files consider using streaming instead of the byte array approach suggested here.

Store images in sql server[^]
   
Rate this:
Please Sign up or sign in to vote.

Solution 1

   
Comments
walterhevedeich 23-Aug-11 21:38pm
   
Nice article.

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




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100