|
-
Jan 17th, 2008, 12:19 PM
#1
Thread Starter
Member
Opening files stored in DB
Hello,
I am storing files of different types on a varbinary field in a SQL Server 2005 db.
How can I open the files with its default programme,
i.e. open pdf files in acrobat, jpegs in picture viewer, etc. ?
cheers
-
Jan 17th, 2008, 12:49 PM
#2
Re: Opening files stored in DB
Make sure you store the extension of the file (and name would be good as well) in the database as well. Then, retrieve the file and write it to disk using the name and extension you have. Then, System.Diagnostics.Process.Start() it.
-
Jan 17th, 2008, 12:57 PM
#3
Re: Opening files stored in DB
I should be clearer... you'll get a byte array from the database. Use a BinaryWriter to write to a FileStream object, you can use the FS to save a file to disk.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|