Page 1 of 1

CSV Import ?

Posted: Wed 13 Jul 2011 03:30
by andyscott12
Hi,

I am using DevArt for MySQL and I am trying to import a large CSV file [>1,000,000 rows]

I'm a little unsure the best way to do this using DevArt and was wondering whether you were able to point me in the best direction ?

Thanks

Posted: Fri 15 Jul 2011 13:59
by Shalex
Our ADO.NET Data Providers product line does not include any provider for CSV files. As a solution, we recommend you to use dotConnect Universal, Professional Edition of which includes dotConnect for MySQL Standard Edition. On the other hand, you can install separately Odbc Microsoft Text Driver (*.txt;*.csv) and use it with dotConnect Universal to make a select from the CSV files.

Here is an example of using Odbc Microsoft Text Driver (*.txt;*.csv) with dotConnect Universal:

Code: Select all

string connectionString = @"dbq=D:\TEMP;defaultdir=D:\TEMP;driverid=27;fil=text;filedsn=D:\Program Files\Common Files\ODBC\Data Sources\csv2.dsn;maxbuffersize=2048;maxscanrows=8;pagetimeout=5;safetransactions=0;threads=3;uid=admin;usercommitsync=Yes";

UniConnection connection = new UniConnection("Provider=Odbc;" + connectionString);
UniCommand command = connection.CreateCommand();
command.CommandText = "select * from testCSV.txt";
DataTable table = new DataTable();
connection.Open();
UniDataAdapter da = new UniDataAdapter(command);
da.Fill(table);
return table;