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)

:confused: anybody help me plzzzzzzzzz :confused:

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 .

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.