blah blah blah is here! blah blah » Close

up0down
link

Hello folks,
I'm new in this site.
I've got an sql server 2k database. My OS is Windows XP.
I'm working on Web Forms with ASP.NET.
I've got a table named "Documents" which has a column named "Doc" with "image" as DataType.
I've managed to insert a MS Word document in that column.
The problem is I do not know how to extract and view my document Word from the database !!

I'll be grateful for any help.
thanks.

last answered one year ago

1 answers

up0down
link

something that can help a bit is storing the saved image as a file on the client pc for example and then running it as a normal word document. when u recover the Doc field save this to a temporary file by

DataTable myDat=new DataTable();
myDat=//this is supposed to be the datatable that u store the returned documents from the database in it.
System.IO.File.WriteAllBytes("tempFolder\\MyTempFile.doc",(byte[])myDat.Rows[0]["Doc"]);
Process.Start("tempFolder\\MyTempFile.doc");


hope this helps

upperm
12

Thanks a lot, you were really helpful. Yet, I did not use the DataTable, though I managed to recover the Doc field and save it to my Hard Drive, precisely to a default local directory = C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO 9.0\COMMON7\IDE\TEMPFOLDER. (name of Word Document is "MyTempFile.doc") The C# code is what you advised me to use. Now I'm asking a second question .. What can I do to save the MS Word Document to a Client PC ?? Thank you very much.

Feedback