简体   繁体   English

将文本文件加载到Access数据库的最快方法是什么?

[英]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. 文本文件包含200,000行。

I work with C#. 我使用C#。

Access is quite happy to import CSV files, it can be done through an SQL statement. Access很高兴导入CSV文件,可以通过SQL语句来完成。

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

See: Speed up insert mdb 请参阅: 加速插入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. 我知道最快,最hackest的方法是将数据导入到excel中,然后将其剪切并粘贴到Access中的表中。 If you need something programatically then I am sure a quick search could find a way to read a CSV file in C#. 如果您以编程方式需要一些东西,那么我相信快速搜索可以找到一种在C#中读取CSV文件的方法。 From there you just need to open a C# data source and plow the data in. 从那里,您只需要打开一个C#数据源并将其放入其中即可。

Can you be more specific about your problem... 您能更具体地说明您的问题吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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