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

updating database using datatable

P: n/a
hi guys...

i am a student, i am studying and i am a newbie in VB.net and i am
using SQL Server 2000.

I have this datatable which i insert rows (may take up to 2 or more
rows because i would like to perform batch updating). upon clicking of
update button, i would like to insert them all in a table in my
database.

I know this question has been posted before but could you show me guys
a sample code or a link to a code where i can study how to update a
database by a datatable.

help in anyway is very much appreciated.

Thanks

Joel - newbie

Sep 19 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Hi Joel,

A DataTable is a disconnected set of data. It may or may not be data from a
database, or have anything to do with a database. When a DataTable is
populated from a database, it must be populated by a DataReader, either as a
member of a DataAdapter, or independently. The DataReader or DataAdapter has
the Connection to the database. So, to insert data into a database, either a
Connection and Command must be used, or a DataAdapter, which contains a
Connection and a set of Commands must be used. In any case, the data is not
literally updated as a batch, but in a looping construct that inserts the
records one at a time. How you wish to do the insertion work is up to you.
For more information, see the following:

http://msdn2.microsoft.com/en-us/lib...x7(VS.71).aspx
http://msdn2.microsoft.com/en-us/lib...wf(VS.71).aspx
http://msdn2.microsoft.com/en-us/lib...8z(VS.71).aspx

--
HTH,

Kevin Spencer
Microsoft MVP

DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net

"joel" <co*********@hotmail.comwrote in message
news:11**********************@n39g2000hsh.googlegr oups.com...
hi guys...

i am a student, i am studying and i am a newbie in VB.net and i am
using SQL Server 2000.

I have this datatable which i insert rows (may take up to 2 or more
rows because i would like to perform batch updating). upon clicking of
update button, i would like to insert them all in a table in my
database.

I know this question has been posted before but could you show me guys
a sample code or a link to a code where i can study how to update a
database by a datatable.

help in anyway is very much appreciated.

Thanks

Joel - newbie

Sep 19 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.