CSV Import ?

CSV Import ?

Postby andyscott12 » Wed 13 Jul 2011 03:30

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
andyscott12
 
Posts: 6
Joined: Tue 01 Feb 2011 04:19

Postby Shalex » Fri 15 Jul 2011 13:59

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;
Shalex
Devart Team
 
Posts: 7340
Joined: Thu 14 Aug 2008 12:44


Return to dotConnect for MySQL