建议你对你输入的内容做一个分析然后生成sql语句。直接写sql语句估计写不出来。

解决方案 »

  1.   

    应该是 select * from table where a1='xx1' or a1='xx2' 吧。
    select * from table where a1='xx1' and a1='xx2'好像不对吧。
      

  2.   

    string strFilter="1,2,3,4";
            string []arrFilter=strFilter.Split (',');
    string strSql="select * from xxx where ";
    int i=0;
    for(i=0;i<arrFilter.Length-1 ;i++)
          strSql+="al=" "'"+arrFilter[i] + "'" +" and ";
    strSql+="al="+arrFilter[i];
      

  3.   

    select * from table where a1 in (xx1,xx2,xx3)
      

  4.   

    select * from table where a1 in('xx1','xx2')
      

  5.   

    select * from table where a1 in('xx1','xx2')