Click here to Skip to main content
16,013,822 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
protected void btnTest_Click(object sender, EventArgs e)
{

foreach (GridViewRow row in gvUserGroupDetails.Rows)
{


String access = "";
string add = "";


Label lblMenuID=(row.Cells[0].FindControl("lblMenuID") as Label);
Label lblMenuName=(row.Cells[0].FindControl("lblMenuName") as Label);
CheckBox chkAccess = (row.Cells[0].FindControl("cblAccess") as CheckBox);
CheckBox chkAdd = (row.Cells[0].FindControl("cblAdd") as CheckBox);
CheckBox chkEdit = (row.Cells[0].FindControl("cblEdit") as CheckBox);



if (chkAccess.Checked == true)
{
access = "Y";
}
else
{
access = "N";
}
if (chkAdd.Checked == true)
{
add = "Y";
}
else
{
add = "N";
}




con.exeUpdate("insert into test values(" + lblMenuID + ",'" + lblMenuName + "','" + access + "','" + add + "')");


}



}
Posted
Updated 15-Oct-14 3:25am
v2

Hi,


Please google on C# + ExecuteNonQuery and you will find the necessary information.

Also for a sample please refer below link.

http://www.java2s.com/Code/CSharp/Database-ADO.net/usetheExecuteNonQuerymethodtorunINSERTUPDATEandDELETEstatements.htm[^]

Thanks
 
Share this answer
 

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