C# .NET - How to insert values from datagrid to DB in Windows Application

Asked By Anto Bilson on 11-Feb-11 04:23 AM


  Hi Friends,

  I'm Using Windows Application..I've Developed Datagrid Dynamically for 5 columns and 3 Rows... now i want insert Datagrid values to DB..i've enter values in any columns in 5 Columns and 3 Rows...
 
  pls Give me solution
Anoop S replied to Anto Bilson on 11-Feb-11 04:51 AM
You can bind the dataGridview to the table from the database. By doing that, you just need to call the update-method.

C# Tutorial - Binding a DataGridView to a Database
http://www.switchonthecode.com/tutorials/csharp-tutorial-binding-a-datagridview-to-a-database

Binding database from dataadapter
http://support.microsoft.com/kb/308507
Daivagna Nanavati replied to Anto Bilson on 11-Feb-11 10:27 AM
HI Anto

You can get those values by running foreach or for loop  and insert them one by one in your table using insert query...

let me know

Thanks