multiple insert/update

  • Thread starter Thread starter nicholas
  • Start date Start date
N

nicholas

Where can I find a good tutorial on how to insert/update MULTIPLE rows into
a database on an SQL2000 server ?

In VB !! (not C#)

THX
 
There are basically 2 ways to do this:

1. use the ADO.NET DataSet object, which tracks all inserts and updates to
its in-memory representation. The SqlDataAdapter lets you setup sql commands
that will execute for insert, update and delete. Then you call
SqlDataAdapter.Update and pass in an array of DataRows. There are
variations on this theme that would be covered by any decent ADO.NET book.

2. build the big sql string yourself using StringBuilder. This option
performs better, since only a single batch is submitted to the sql server.
If you need good performance, and know transact sql, just concatenate the
inserts/updates, connect, and execute the entire batch at once. You can
actually walk the DataSet also to generate this sql. This technique may not
be in too many tutorials.
 

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

Back
Top