Array to Database

  • Thread starter Thread starter elziko
  • Start date Start date
E

elziko

I'm using OLEDB in .NET to get my data into a database. The data starts off
in an 2-D array of singles where the first dimension represents columns in a
database table and the second dimension represents rows in the same table.

At the moment I have a single connection & transaction and I am loading the
data into the database by iterating through the array and creating an INSERT
OLEDBCommand for each row in the array and then executing the command.

This works but is very slow. Is there a quicker way to get an array such as
mine into the database?
 
Hi,

What kind of database are you using? In a case of SQL Server 2000 you could
pass all the values into stored procedure as XML and do insert inside of
this SP using one shot. It would work faster
 
elziko
This works but is very slow. Is there a quicker way to get an array such as
mine into the database?

Yes use a datatable what is the standard 2 dimensional array inside dotNet
in combination with a dataset

Very simple to use by the way

I hope this helps?.

Cor
 
Have you tried batch all your insert statements in one command? That should
avoid all the round-trips from db and should give you a nice performance
boost.
 
Back
Top