473,396 Members | 1,929 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How to read flat file into Access Database?

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();
Sep 5 '06 #1
1 2036
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...ers_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
"elena" <el***@discussions.microsoft.comwrote in message
news:42**********************************@microsof t.com...
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();

Sep 5 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Yang Li Ke | last post by:
Hi guys! I have some datas that I must check everytime a visitor comes to my site What is better to do: 1- Read data from a file or 2- Read data from a mysql db Thank you
4
by: ED | last post by:
I currently have 2 oracle databases that my access database is going to gather data from. The IT department wants to give me data snaps in the form of a flat file. They will FTP the flat file to...
1
by: Tim Fierro | last post by:
Hello, I have had many years using flat file databases (File Express from way back) but am now at a company where a relational database is needed and would carry us into the future. Since I...
2
by: Bill Nguyen | last post by:
I need to parse a text file with fixed columns into a table. I have the file spec (column positions) but don't know how to use it. Thanks Bill
14
by: vunet.us | last post by:
Hi, I would like to use flat file data storage instead of database. Since I am new to it, I am wondering: What text file extension is a safe one to store my data online and how cost- and...
1
by: hkhella | last post by:
I receive several flat files daily that need to be improted into my Access Database. Each file record starts with a specific letter or group of letters, the following lines or rows in the flat file...
3
by: Thom Little | last post by:
I need to maintain data in a flat file (probably a tab delimited .txt file) and would like to access it with gatagrid. I would populate it during startup and save it on exit. Can I access a...
15
by: lxyone | last post by:
Using a flat file containing table names, fields, values whats the best way of creating html pages? I want control over the html pages ie 1. layout 2. what data to show 3. what controls to...
3
by: Flugeldorph | last post by:
I am new to Visual Basic, my preferred languages is C or C++. I am trying to load a local database with data that I am reading from a delimited flat file. I have created the database tables and...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.