"update Group_Action set WebCheckked=1 where TITLE in ('" + ids.Substring(0, ids.Length - 1) + "')";
我后台代码是这样的,运行后的SQL语句是这样:
update Group_Action set WebCheckked=1 where TITLE in ('222,42342')
现在我想要SQL语句变成:
update Group_Action set WebCheckked=1 where TITLE in ('222','42342')这样的
那我后台代码中的那句话里,这个单引号应该添加到哪里?

解决方案 »

  1.   


    static void Main(string[] args)
            {
                string ids = "222,42342#";
                ids = ids.Substring(0, ids.Length - 1);
                string[] strArr = ids.Split(',');
                string sql = string.Format("update Group_Action set WebCheckked=1 where TITLE in ('{0}','{1}')", strArr[0], strArr[1]);
                Console.WriteLine(sql);
                Console.Read();
            }
      

  2.   

    不是哪一句单引号要去掉,是楼上的方式,应该在update上面做一下拆分参数,在把参数合并放入