DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   VB.NET (http://www.daniweb.com/forums/forum58.html)
-   -   Storing Data from different file formats to a Database (http://www.daniweb.com/forums/thread114725.html)

Programmer666 Mar 19th, 2008 12:21 pm
Storing Data from different file formats to a Database
 
Hi Friends,
I am new to VB.Net 2005.I need to create a program which will store data from text files,word documents,excel files,xml files to a database.Can anyone help me.it is urgent.Thank you.

bwkeller Mar 20th, 2008 11:02 am
Re: Storing Data from different file formats to a Database
 
If using SQL Server create an Image or nVarChar field in your database table to hold the data. The process is not that different from storing a picture so this code should help a lot. You will basically choose a file, open it as a FileStream and read it into a buffer that you will upload to the database. You can even use the built-in compression processing by pushing it through a GZipStream. Also store the original filename and you can pull it back out and reconstitute the file easily.

bwkeller Mar 20th, 2008 12:20 pm
Re: Storing Data from different file formats to a Database
 
You might find this code easier to understand as it is not ASP code.

Programmer666 Mar 20th, 2008 2:17 pm
Re: Storing Data from different file formats to a Database
 
Thanks Bwkeller, But perhaps I wasnt clear enough.I have data in a text files,Excel Files ,Word Document .Its like it has details of peoples are in the files like Name,Address,Phone Number,Age ,DOB.I need to take the data's from ,text files and Excel Files,Word Documents . I need put those data's from these different types of file in a database.Hope I am able to explain what I want.

bwkeller Mar 20th, 2008 11:20 pm
Re: Storing Data from different file formats to a Database
 
Quote:

Originally Posted by Programmer666 (Post 565479)
Thanks Bwkeller, But perhaps I wasnt clear enough.I have data in a text files,Excel Files ,Word Document .Its like it has details of peoples are in the files like Name,Address,Phone Number,Age ,DOB.I need to take the data's from ,text files and Excel Files,Word Documents . I need put those data's from these different types of file in a database.Hope I am able to explain what I want.

Well that is a different matter. You would have to look up the different APIs for the different file formats. This is how to read Word files with C# which can be converted to VB.NET here. This code reads Excel files using VB.NET and text files can be read pretty natively with VB.


All times are GMT -4. The time now is 8:18 am.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC