下面代码错在哪,为什么只要在大量添加信息的时候,这里就出错!!
下面代码错在哪,为什么只要在大量添加信息的时候,这里就出错!!
如果不进行大量添加信息的时候,这里的多选操作都很正常,一大量添加信息的时候
操作就乱了,明明的是选的这几个ID,却删除了另外几个ID,怎么回事呢
protected void Btn_Do_Click(object sender, EventArgs e)
{
string keyValues = " ";
for (int i = 0; i < Repeater.Items.Count; i++)
{
CheckBox chkbox = (CheckBox)Repeater.Items[i].FindControl( "op ");
if (chkbox!=null)
{
if (chkbox.Checked == true)
{
string key = ((Label)Repeater.Items[i].Controls[2]).Text + ", ";
keyValues = keyValues + key;
}
}
}
if (keyValues != " ")
{
keyValues = keyValues.Substring(0, keyValues.Length - 1);
SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings[ "sqlcon "]);
con.Open();
string nowtime = DateTime.Now.ToString();
string op = ddl_op.Text.ToString();
string cmdsql = " ";
if (op == "del ")
{
cmdsql= "delete from " + tablename + " W