2

I need to insert to the Microsoft Access Database (accdb file) large amount of data (about 500MB per table).
My soft downloads table A from the net and I have an DataTable object with data from table A. Inserting data row by row using OleDbCommand (ADO.NET provider) takes to much time. What is more, the more records are in the database, the more time inserting takes.

Is there any alternative to insert data faster (all the datatable per command)? Destination database could has rows before inserting my rows.

Regards, Jakob.

Jens Kloster
  • 11,099
  • 5
  • 40
  • 54
Kuba Matjanowski
  • 350
  • 3
  • 14
  • I've tried DAO for inserting data. It is much faster but effects the restrictions. OleDB is much more convenient, but the speed is priority for me now. – Kuba Matjanowski Jul 23 '13 at 10:24

1 Answers1

1

Try this to perform bulk insert . More Info :INSERT INTO Statement (Microsoft Access SQL)

var cmdText = "INSERT INTO Table1 SELECT * FROM Table2";
var command = new OleDbCommand(cmdText, connection);
command.ExecuteNonQuery();

Or you can take a look at This article

Note: The above code perform bulk insert from one accdb to another accdb .However there is no bulk insert method from Dataset to Access DB, you would have to insert the data row by row.

Community
  • 1
  • 1
Rohit
  • 10,056
  • 7
  • 50
  • 82