表中有这样一个字段“类别",他的可能值为多个:学生,老师,工人     
也可能为一个值比如:老师
现在a='学生'为什么一下查询为0?应该怎么写?
sql="select * from table where 类别 like '" & a & "'"
data1.recordsource=sql
data1.refresh
但是结果是0条记录。

解决方案 »

  1.   

    数据库中有 学生 的数据吗
    like的用法好像是 like '%"& a &"%'
    我感觉你的like用法不对如果直接用 where 类别 = '" & a & "'"
    有数据吗
      

  2.   

    strSql="Select * From table where 类别 like '%" & a & "%'"rs.Open strSql
      

  3.   

    sample:msg=trim(inputbox("写上输入的内容:"    学生,老师,工人))
    msg="类别 like '" & msg & "'“
    data1.recordset.findfirst msg
    if data1.recordset.nomatch then
    msgbox"no  record"
    end if
      

  4.   

    sql="select * from table "
    data1.recordsource=sql
    data1.refresh
    先这样查询如果有记录
      

  5.   

    怎么给不了分,什么叫帖子回复次数大于给分次数?csdn,怎么着了这时,mmd