updating database using datatable

J

joel

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
 
K

Kevin Spencer

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/library/0fx37fx7(VS.71).aspx
http://msdn2.microsoft.com/en-us/library/3btz0xwf(VS.71).aspx
http://msdn2.microsoft.com/en-us/library/bh8kx08z(VS.71).aspx

--
HTH,

Kevin Spencer
Microsoft MVP

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

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