检查并没有更新到sql2005后,GridView内部复选框的状态未更改 [英] status of checkbox inside gridview not changed after checking and not update to sql2005
本文介绍了检查并没有更新到sql2005后,GridView内部复选框的状态未更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
foreach (GridViewRow rowI
tem in GridView1.Rows)
{
CheckBox chk = (CheckBox)(rowItem.Cells[7].FindControl("ch1"));
try
{
if (chk == null)
{
Label3.Text = "hai";
SqlConnection myConnection = new SqlConnection("Data Source=PCIMS051;Initial Catalog=unblockingwebsite;Integrated Security=True");
myConnection.Open();
SqlCommand myCommand = new SqlCommand("INSERT INTO twebsite_unblocking (Requested_Status) " + "Values ('2')", myConnection);
myCommand.ExecuteNonQuery();
myConnection.Close();
}
}
catch { }
}
更新取消Requested_ID Requested_by Action_taken Action_remark Action_taken_by Action_taken_date Request_Status
标签文本已更改,但复选框状态未更改,并且未更新为gridview
Update Cancel Requested_ID Requested_by Action_taken Action_remark Action_taken_by Action_taken_date Request_Status
Label text changed but check box status not changed and not update to gridview
推荐答案
//如果coloumn数据类型为int,则删除qouts示例值(2)
//验证是否对数据库进行了更改
//if coloumn datatype is int then remove qouts example values(2)
// validate whether changes made to database
if( myCommand.ExecuteNonQuery() > 0 )
{
Response.Write("success");
}
else
{
Response.Write("failed");
}
这篇关于检查并没有更新到sql2005后,GridView内部复选框的状态未更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文