vb.net and sql2000

B

Brian Shannon

I run a vb.net application and store info into a datatable while processing.
I end up with a few hundred records when finished. After processing is
finished I need to take the records and update them into the sql DB.

Currently I loop through the datatable and insert one record at a time using
the sqlcommand ExecuteNonQuery(). Is there a better way?

All the reocords are new records so none of them will need updating. Once
the record is inserted into my datatable it is in its final form to be
inserted into my DB table. It's also at this point that I begin any
database connection steps needed.

Thanks for any suggestions
 
L

Lucas Tam

Currently I loop through the datatable and insert one record at a time
using the sqlcommand ExecuteNonQuery(). Is there a better way?

You could call a .Update from the DataAdapter. Or you could use a
Dataset... I think a Dataset has a .Update method too.
 
C

Cor Ligthert

Hi Brian,

When there cannot be a concurrency problem (you are sure that the primary
key of records does not exist) than you have in my opinion now the best
solution.

The dataset does exactly the same, however has of course more overhead.

I hope this helps?

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top