load flat file into datatable

  • Thread starter Thread starter georgejetson
  • Start date Start date
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?
 
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!
|
*************************************************
 
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.
 
Back
Top