i have this project that occassionally the user will insert several thousand rows. currently that ranges from about 3000 to 6000 on the high end and it is highly unlikely that it will ever exceed 15000.
these items happen to be a collection of objects so first i tried
foreach(object obj in myObjects)
{
//sqlinsertcommand
}
that took about 52 seconds to run which is unacceptable
so then i added the collection to a datatable and executed the dataadapter.update
that knocked it down to about 13 seconds.
which is almost acceptable in fact it probably would pass but there has to be a faster way. Anyone have any suggestions. On a side note, i dont understand why using the dataadapter.update is so much faster than executing an Command.ExecuteNonQuery for each object in the collection.
these items happen to be a collection of objects so first i tried
foreach(object obj in myObjects)
{
//sqlinsertcommand
}
that took about 52 seconds to run which is unacceptable
so then i added the collection to a datatable and executed the dataadapter.update
that knocked it down to about 13 seconds.
which is almost acceptable in fact it probably would pass but there has to be a faster way. Anyone have any suggestions. On a side note, i dont understand why using the dataadapter.update is so much faster than executing an Command.ExecuteNonQuery for each object in the collection.