简体   繁体   中英

What is the fastest way to load a text file to an access Database?

I have Text file that contains data separated with a comma , .

How do I load this to access in the fastest way?

The Text file contains 200,000 rows.

I work with C#.

Access is quite happy to import CSV files, it can be done through an SQL statement.

SELECT ID,Field1 INTO NewTable 
FROM [Text;HDR=YES;FMT=Delimited;IMEX=2;DATABASE=C:\Docs\].Some.CSV

See: Speed up insert mdb

如果您有2个硬盘驱动器,则尝试将文本文件放在一个硬盘驱动器上,将访问数据库放在一个硬盘驱动器上,然后可以尝试使用2个线程,一个用于读取,一个用于写入。

the fastest and hackiest way I know would be to import the data to excel and then cut and paste it into the table in Access. If you need something programatically then I am sure a quick search could find a way to read a CSV file in C#. From there you just need to open a C# data source and plow the data in.

Can you be more specific about your problem...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM