sql_str = "Update orders Set orderState = @orderState where ono in (" + Request.Form["ono"] + ")";报错:列名 'RT110810100459' 无效。
      列名 'RT110813163011' 无效。
字段ono是VarChar不是Int ,难道in 只能用于数字不能是字符串吗?

解决方案 »

  1.   

    你的sql最后完整的是什么内容,确定列名的正确性
      

  2.   

    数值
    select * from tb where col in (1,2,3,4,5,6)
    字符
    select * from tb where col in ('1','2','3','4')这样-----
    你  Request.Form["ono"] 里面的值是什么样的,印出来看看
      

  3.   

    sql_str = "Update orders Set orderState = @orderState where ono in ('RT110810100459','RT110810100222')";我直接这样写,结果不报错了,但所有字段的数据都变了,并没有根据where ono in 条件
      

  4.   

    Request.Form["ono"] 的值是这样的:
    RT110902210613
    RT110901160455
    RT110822213653
    RT110810100222
    ....
      

  5.   

    sql中字符串操作要用 单引号括起来one in ('RT110902210613','RT110901160455','RT110822213653','RT110810100222')
    必须把字符串sql弄成这个样子
    才能正确执行
      

  6.   


    String a =  Request.Form["ono"] ;
    a = a.Replace("\r\n", "','");
    a = "'" + a + "'";sql_str = "Update orders Set orderState = @orderState where ono in (" +a+ ")";