How to read flat file into Access Database?

G

Guest

I have large flat file with fixed record lenght, i have to parse record and
populate table with multi columns with the data,
please any links or code snipets to this topic will be greatly appreciated

OleDbConnection Conn = new
OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;" + "Data
Source=C:\\Archive\\Test.mdb;");

string myInsertQuery = "INSERT INTO ClientsTB (TicketNo, IssueDate,
IssueTime, Location, Notes, Plate) Values('6020012345', '09/05/06', '12:00',
'Main street', 'Test', 'TEST')";
OleDbCommand myCommand = new OleDbCommand(myInsertQuery);
myCommand.Connection = Conn;
Conn.Open();
myCommand.ExecuteNonQuery();
myCommand.Connection.Close();
 
S

sloan

You can use the OleDbConnection.

Treat the directory as the databaseName.
Treat the filename as the tableName.

c:\myfolder\myfile.txt

"Select * from myfile.txt" is the query.

The database name is
"c:\myfolder\"

Something like that.

http://www.adoreport.com/doc/htmldoc/ADOReport_Users_Guide.html
Text - fields separated with semicolon
Ado Data Provider = Microsoft.Jet.OLEDB.4.0
Datasource = C:\TextDir;Extended Properties="text;HDR=No;FMT=Delimited;"
User Id = Admin
Password =
Select * from textFile.txt
 

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