0

How to store files(.doc files,.zip files) in a database and how to retrieve them.

Thanks in advance.

3
Contributors
2
Replies
4
Views
9 Years
Discussion Span
Last Post by JerryShaw
0

If you use Microsoft SQL Server 2008 there is FileStream datatype.
If you use Microsoft SQL Server 2000/2005 the optimal solution is to save file path rather file itself.

0

You can save any size file, or image or anything else that you want into an SQL database.
This capability has been around even back when SQL was SyBase.
The Text field is a BLOB field. Use a byte[] array, and stream the file into the field through a memorystream or filestream. When you want to get it back our, again, use a byte array to stream it out. Check out how to store and retireve images, and you use the same method for files.

There are lots of document companies that store zip files, PDF, and Word Doc files (and other types) directly into SQL databases. Storing to the hard drive is not a good option because it opens a security hole if the customer has to have a network share to retireve the file.

Jerry

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.