C# get gridView all row value
Posted on Sunday, May 1, 2011
|
No Comments
foreach (GridViewRow gvr in GridView1.Rows) //loop through GridView
{
OleDbConnection conn = new OleDbConnection("your_connectionstring");
//suppose ItemCode is in the first column and Quantity is in the third column of GridView
OleDbCommand cmd = new OleDbCommand("insert into [QDETAILS](ItemCode,Quantity) values (" + gvr.Cells[0].Text + ",'" + gvr.Cells[2].Text + "')", conn);
conn.Open();
cmd.ExecuteNonQuery();
conn.Close();
}