User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the ASP.NET section within the Web Development category of DaniWeb, a massive community of 391,548 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,520 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ASP.NET advertiser: Lunarpages ASP Web Hosting
Views: 3934 | Replies: 1
Reply
Join Date: May 2005
Posts: 15
Reputation: ramareddy_dotne is an unknown quantity at this point 
Rep Power: 4
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

  #1  
Mar 14th, 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
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Mar 2006
Location: Egypt,Cairo
Posts: 31
Reputation: web developer is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
web developer's Avatar
web developer web developer is offline Offline
Light Poster

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

  #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  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb ASP.NET Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the ASP.NET Forum

All times are GMT -4. The time now is 9:02 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC