Click here to Skip to main content
15,888,610 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I need to be able to primarily retrieve Word template documents from SQL Server 2005 to be filled with bookmark information for postal letters.

I have been Gooling for a while now and all the results are for ASP.NET using a FileUpload object can anyone tell me what the equivalent is for Winforms?

Thanks.
Posted

1 solution

You can use OpenFileDialog[^] in WinForms. see the example on the same page. you can store the myStream in the SQL Server 'Image' / 'VarBinary' datatype and retrieve it anytime.

If you need an example how to store binary contents in sql server then here is a nice example.[^].

Following are the steps to Store / Retrieve document using SQL Server

1) read the file contents in binary array using OpenFileDialog.

2) save the binary contents in sql server table, that has atleast one column (FileContents) with data type either Image or VarBinary and another one with FileName VarChar(255).

3) Read the contents of the FileContents column and save it in a temp folder with the FileName column. and read the file from there...
 
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