Web App Storing Documents in SQL Server
-
Hi, I'm a newbie trying to write a fairly simple web app in C# with two complex issues - I need to present a document dialog box to the user, let them select a (usually MS Word) document on their local drive(s) and store it in a SQL Server 2000 table/column. I'm wondering if someone has some sample code (preferably C#) and can tell me what type of column needs to be defined in SQL Server to hold the document. I'll also need the reverse: pulling the document out (mostly Word documents) and displaying it in the browser window. I'm basically trying to store and retrieve these Word documents from various users in SQL Server 2000. Any help would REALLY be appreciated! Thank you very much in advance! Mike L.
-
Hi, I'm a newbie trying to write a fairly simple web app in C# with two complex issues - I need to present a document dialog box to the user, let them select a (usually MS Word) document on their local drive(s) and store it in a SQL Server 2000 table/column. I'm wondering if someone has some sample code (preferably C#) and can tell me what type of column needs to be defined in SQL Server to hold the document. I'll also need the reverse: pulling the document out (mostly Word documents) and displaying it in the browser window. I'm basically trying to store and retrieve these Word documents from various users in SQL Server 2000. Any help would REALLY be appreciated! Thank you very much in advance! Mike L.
Hi Mike, + To display a dialog box which allows the user to select a document on the client machine and upload it to the server, you can use an input file element. You can find the article posted on CP as an example: http://www.codeproject.com/aspnet/fileupload.asp[^] + To store the Word document in SQL, you can define a column of the image type. + To insert/retrieve the content of the word document, you can use the ADO.NET[^] to implement the functionality. In addition to the above example, you can check out tons of examples in MSDN[^], CP and the internet. + To display the word document in the browser, you can save the content to disk and simply use a link to point to the file. You can also write out the content to the output stream of the Reponse object. Again, the above fileupload article can give you an idea on the issue.