Groups | Blog | Home
all groups > vb.net data > october 2006 >

vb.net data : Insert data into SQL DATABASE table from datatable


Rod
10/27/2006 2:04:01 PM
Hi at all!
I have an HASTABLE (datatable) used as schopping-cart in my web application
(.aspx).
When I confirm the order I want insert in my table "ORDERS" of SQL Database
all data of my HASHTABLE.
How could I do ?

Thanks,
Antonio


JerryWEC
10/27/2006 3:22:58 PM
Rod, here are the basic steps...

1] Create a DataAdapter object (da) and connect to your table in the
database.
2] Create a DataSet object (ds) and fill the ds with existing data form the
db.
3] The hashtable is a collection object, now cycle through it and add each
of the rows in the hashtable to a DataRow object. Then add the DataRow
object the DataTable in the ds object.
4] Once all of the rows are added to ds then update the data back to the
database using the da object.

JerryM

Rod
10/30/2006 12:00:00 AM
Thanks a lot!
Could you, please, write the code ?

Antonio

"JerryWEC" <JerryWEC@newsgroups.nospam> ha scritto nel messaggio
news:enKJR1f%23GHA.1200@TK2MSFTNGP02.phx.gbl...
[quoted text, click to view]

AddThis Social Bookmark Button