Hi ,
I am working on web application in ASP.NET. I want to let my user to create word document using my web page. I accessed Microsoft word 2003 on my web page. I want that this word document which user will write or create , should be save into table of sql server.
Please help me , by providing any code or link
Thanks
Khurram
Loading
mupparaju sureshPosted Apr 19, 2006, 7:45 AM
Hai,
see this code,
int intDocLen = txtFileContents.PostedFile.ContentLength;
string strDocType;
byte[] Docbuffer = new byte[intDocLen];
Stream objStream;
SqlConnection BooksConn = new SqlConnection("server=sqldevserver;uid=sa;pwd=sa;database=tempdb");
SqlCommand cmdUploadDoc = new SqlCommand("uS_BooksUploadFile",BooksConn);
System.IO.FileInfo extfile = new FileInfo(txtFileContents.PostedFile.FileName);
strDocType = extfile.Extension;
objStream = txtFileContents.PostedFile.InputStream;
objStream.Read(Docbuffer,0,intDocLen);
cmdUploadDoc.CommandType = CommandType.StoredProcedure;
cmdUploadDoc.Parameters.Add("@Title ",SqlDbType.VarChar,200);
cmdUploadDoc.Parameters.Add("@Doc",SqlDbType.Image);
cmdUploadDoc.Parameters.Add("@DocType",SqlDbType.VarChar,4);
cmdUploadDoc.Parameters[0].Value = txtTitle.Text;
cmdUploadDoc.Parameters[1].Value = Docbuffer;
cmdUploadDoc.Parameters[2].Value = strDocType;
BooksConn.Open();
cmdUploadDoc.ExecuteNonQuery();
BooksConn.Close();