Click to See Complete Forum and Search --> : Inputting data into Database using Datagrid


srijyothi
June 7th, 2007, 05:10 PM
Hi,
I have a datagrid with 100 records.I have to put these records into the database.Just inserting new records into the database not like updating using datagrid.How to do this.Help is appreciated.Thank you.

Shuja Ali
June 8th, 2007, 12:23 AM
If your datagrid is bound to a dataset then you can use the TableAdapter's Update method to insert the data into the database. Take a look at this
http://msdn2.microsoft.com/en-us/library/ms233812(VS.80).aspx

In case your datagrid is not bound then you will have to use Command objects to do a manual insert. Loop through each record and manually execute Insert commands using the command object.