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
Printable View
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
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.
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.