Click here to Skip to main content
14,879,536 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi...i am displaying dynamically data in datable like this code...i dont know how to insert the modified data from datagridview to database.....

C#
int sitting = Convert.ToInt32(D3.Text);
 DataTable dt = new DataTable();
 DataRow dr;
 dt.Column1.Add("Treatment Name");
 dt.Columns.Add("Detail");
dt.Columns.Add("amount");
for (int i = 0; i < sitting; i++)
{
 dr = dt.NewRow();

 dr["Treatment Name"] = D1.Text;
    dr["Detail"] = D2.Text;
   dr["amount"] = "";
   dt.Rows.Add(dr);
   }
  dataGridView1.DataSource = dt;
Posted
Updated 13-Feb-12 22:36pm
v2
Comments
M_Mogharrabi 14-Feb-12 4:50am
   
You can use CellEndEdit event of datagridview.it occurs after a cell edited by the user.also you can access to index of edited column with 'e' parameter of this event.

actually i dont need to update data...how dynamical displaying data in datagridview insert into database using datatable....
   
Comments
M_Mogharrabi 14-Feb-12 4:52am
   
please describe your question more...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900