By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,990 Members | 2,279 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,990 IT Pros & Developers. It's quick & easy.

vb.net and sql2000

P: n/a
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

Nov 20 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
* "Brian Shannon" <bs******@lbrspec.com> scripsit:
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.


For data(base) related questions, give this group a try:

<URL:news://news.microsoft.com/microsoft.public.dotnet.framework.adonet>

Web interface:

<URL:http://msdn.microsoft.com/newsgroups/?dg=microsoft.public.dotnet.framework.adonet>

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #2

P: n/a
"Brian Shannon" <bs******@lbrspec.com> wrote in
news:ug**************@TK2MSFTNGP12.phx.gbl:
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.

--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/
Nov 20 '05 #3

P: n/a
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
Nov 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.