在SQL语句中使用了like关键字,select * from a where 1='%"+1+"%'
是不是这样的格式啊?

解决方案 »

  1.   

    string sql="select * from a where 1 like '%"+1+"%'";类似这样
      

  2.   

    string sql="select * from a where a.要筛选的列名 like '%'+要筛选的条件关键字【如果传入非字符类型则应该是:str(要筛选的条件关键字)】+'%'
      

  3.   


    select * from a where name like '%李%'select * from a where name like '%'+'李'+'%'
    delcare @a nvarchar(10)
    select * from a where name like '%'+@a+'%'
    like要与通配符一起使用
    % 匹配0或多个_ 匹配一个
      

  4.   

    ..纯SQL问题
     模糊语句
     具体打开SQL2000 按F1.
      

  5.   

    select * from a where [name]='%aa%' 这样c#里可以这样
    string str = "select * from a where [name]='%"+变量+"%'"
      

  6.   

    string sql=string.Format("select * from 表名 where 字段名 like '%{0}%'",变量名);