Using .NET to import a delimited text file into an Access database

  • Thread starter Thread starter temp
  • Start date Start date
T

temp

Greetings!

I have been attempting for the past two days to create a fast and
efficient way of importing data from a delimited text file into an
Access database. I've (finally) found out how to get the text file
into a DataSet using the OLE DB classes and have no problems viewing
the data. Now I cannot seem to put it into an Access database!

I've tried using various methods available to the DataSet and
DataAdapter classes and checked out many web references on how to work
with these classes. But the references aren't of much assistance and
using the methods for the classes, while able to compile and run
successfully, does not actually put the data into the Access database!
The only way I've found to import the data is to enumerate through the
DataRows of the DataSet, create an INSERT statement from the data, and
perform the query. Given the proported functionality of .NET, there
has to be a faster, more efficient, and above all simple way of doing
this!

Can anyone provide me with some pointers, books, or sites to assist me?
Thanks.
 
Greetings!

I have been attempting for the past two days to create a fast and
efficient way of importing data from a delimited text file into an
Access database. I've (finally) found out how to get the text file
into a DataSet using the OLE DB classes and have no problems viewing
the data. Now I cannot seem to put it into an Access database!

I've tried using various methods available to the DataSet and
DataAdapter classes and checked out many web references on how to work
with these classes. But the references aren't of much assistance and
using the methods for the classes, while able to compile and run
successfully, does not actually put the data into the Access database!
The only way I've found to import the data is to enumerate through the
DataRows of the DataSet, create an INSERT statement from the data, and
perform the query. Given the proported functionality of .NET, there
has to be a faster, more efficient, and above all simple way of doing
this!

Actually this is very simple, and much faster in Access. Just open the
Access database and add a linked table pointing to your text file. Then

Insert into MyTable select * from MyLinkedTextFile

.. It .NET is's much harder more indirect, and much much slower because you
have to generate single-row inserts for each row.

David
 
Back
Top