944,198 Members | Top Members by Rank

Ad:
  • ASP.NET Discussion Thread
  • Unsolved
  • Views: 6687
  • ASP.NET RSS
Mar 15th, 2006
0

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

Expand Post »
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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
ramareddy_dotne is offline Offline
15 posts
since May 2005
Mar 15th, 2006
0

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

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 .
Reputation Points: 10
Solved Threads: 0
Light Poster
web developer is offline Offline
36 posts
since Mar 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP.NET Forum Timeline: How to Incorporate Director?
Next Thread in ASP.NET Forum Timeline: Web Service with ASP .Net





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC