load flat file into datatable

G

georgejetson

Anyone,

I'm looking for a way to load flat files into a datatable in vb.net (2005)

My flat files are tabbed delimited files with the field names on the first row

I could dump the data into a sqlserver via DTS and then query against a
table, but I'd like to figure out how to go directly from flat file to
datatable/dataset.

Any examples out there?
 
C

Cowboy \(Gregory A. Beamer\)

Look down at ODBC driver for text, as one example:
http://www.codemaker.co.uk/it/tips/ado_conn.htm

The Jet OLEDB provider can also be used for tab delimited files. I do not
have an example readily available.

If you can create a strongly typed dataset, you can easily fill it with data
from the tab delimited file using a stream reader and spliting on \t (C#) to
get each field. Adding records is an easy recursive loop. You do not have to
go this route, however, as you can use the ODBC driver.

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

*************************************************
| Think outside the box!
|
*************************************************
 
R

Rad [Visual C# MVP]

Anyone,

I'm looking for a way to load flat files into a datatable in vb.net (2005)

My flat files are tabbed delimited files with the field names on the first row

I could dump the data into a sqlserver via DTS and then query against a
table, but I'd like to figure out how to go directly from flat file to
datatable/dataset.

Any examples out there?

Check out a free, opensource library called FileHelpers designed with
precisely these scenarios in mind.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top