gridView 中使用CheckBox获得参数问题
CheckBox CheckBox1 = this.GridView1.Rows[i].Cells[5].FindControl("CheckBox1") as CheckBox;
if (CheckBox1.Checked)
{
string title = CheckBox1.Checked.ToString();
SqlWebDal swd = new SqlWebDal();
string sqlcontent = "UPDATE Tips SET Release ='" + title + "'";
swd.GetSqlCmd(sqlcontent);
SqlGadgetDal sgd = new SqlGadgetDal();
sgd.GetSqlCmd(sqlcontent);
}
else
{
//string title = CheckBox1.Checked.ToString();
SqlWebDal swd = new SqlWebDal();
string title = CheckBox1.Checked.ToString();
string sqlcontent = "UPDATE Tips SET Release ='" + title + "'";
swd.GetSqlCmd(sqlcontent);
SqlGadgetDal sgd = new SqlGadgetDal();
sgd.GetSqlCmd(sqlcontent);
}
string title = CheckBox1.Checked.ToString();一个是传来的选中,一个是不选中,数据库是BOOL型的
为什么ELSE里的内容不改变呢.