我想通过用户输入的字符串来查找库中有没有包含这个字符串的记录,凡是有的都列出来,而且希望能查找含有两个不同的字符串的记录,我查过以前的贴子,都不行,出错,请高手给代码

解决方案 »

  1.   

    dim strSql as string
    strSql = "SELECT * FROM WHERE XXX =" & youstring1 & "' And XXX='" & youstring2 & "'"
    rs.open strSql
      

  2.   

    错了,真晕,应该是
    dim strSql as string
    strSql = "SELECT * FROM youtable WHERE XXX ='" & youstring1 & "' And XXX='" & youstring2 & "'"
    rs.open strSql
      

  3.   

    如果有DAO的话就是:
    set rst=dbs.opendatabase("select * from table where [x1]='" & aa & "'and [x2]='"& bb &"'")
      

  4.   

    要么用ado.recordset 的find方法,要么直接用sql语句进行操作
      

  5.   

    用SQL语句最方便,select * from tablename where 字段 like '%" & yourstring & "%'"