how to upload a ms word file and store it in sql table

Please support our ASP.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: May 2005
Posts: 15
Reputation: ramareddy_dotne is an unknown quantity at this point 
Solved Threads: 0
ramareddy_dotne ramareddy_dotne is offline Offline
Newbie Poster

how to upload a ms word file and store it in sql table

 
0
  #1
Mar 15th, 2006
I want a code to upload a ms word file and store it in sql table.I need this very urgently for my project in asp.net(vs 2003)

anybody help me plzzzzzzzzz
Reply With Quote Quick reply to this message  
Join Date: Mar 2006
Posts: 36
Reputation: web developer is an unknown quantity at this point 
Solved Threads: 0
web developer's Avatar
web developer web developer is offline Offline
Light Poster

Re: how to upload a ms word file and store it in sql table

 
0
  #2
Mar 15th, 2006
Hi ,
you can do that by simply converting any file to an array of bytes - bytes[] (in c#) or bytes() (in vb.net) .
you can add an HTML control ( file )-which browses on file name - and let its name file_upload , right click and selct "run as server control" to use it in the c# or vb.net code.

in C#
int len=file_upload.PostedFile.ContentLength;
byte[] bData=new byte[len];
//fill array of bytes
file_upload.PostedFile.InputStream.Read(bData,0,len);


Note the field type of database (in Sql server) should be image .
You must send the value by a parameter and the value of the parameter will be the array filled .

param1.value=bData ;
then executeNonquery(); will insert the file .

I hope i could help you .
Life Is A Big Code
Rushdy Ibrahim
Egypt
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC