datagrid已经和数据库连接好了,可以浏览所有数据。现在通过查询把RECORDSET移动要搜索到的某一条记录?如果有多条记录,从第一个搜索到最后一个。

解决方案 »

  1.   

    不要只显示符合要求的记录,我只是想把datagrid的记录移动,而不是重新设置他的DataSource属性。用什么办法!!!????
      

  2.   

    recordset有個find方法:SyntaxFind (criteria, SkipRows, searchDirection, start)Parameterscriteria   A String containing a statement that specifies the column name, comparison operator, and value to use in the search. SkipRows   An optional Long value, whose default value is zero, that specifies the offset from the current row or start book to begin the search. searchDirection   An optional SearchDirectionEnum value that specifies whether the search should begin on the current row or the next available row in the direction of the search. Its value can be adSearchForward or adSearchBackward. The search stops at the start or end of the recordset, depending on the value of searchDirection.start   An optional Variant book to use as the starting position for the search.ResThe comparison operator in criteria may be ">" (greater than), "<" (less than), "=" (equal), ">=" (greater than or equal), "<=" (less than or equal), "<>" (not equal), or "like" (pattern matching).The value in criteria may be a string, floating point number, or date. String values are delimited with single quotes (for example, "state = 'WA'"). Date values are delimited with "#" (number sign) s (for example, "start_date > #7/22/97#").If the comparison operator is "like", the string value may contain "*" (one or more occurrences of any character) or "_" (one occurrence of any character). (For example, "state like M_*" matches Maine and Massachusetts.)
      

  3.   

    用rs.movenext一条一条的去找,找到为止
      

  4.   

    god!
    哪还不乘着年轻多学点!
    你想等“用汉字编写程序“那天的到来么??
      

  5.   

    rs.open "select.............
    .......
    rs.move 变量,1

      rs.find "string='"& char &"'"
      

  6.   

    嘿,送佛送到西~~~~自己查MSDN嘛语法Find (criteria, SkipRows, searchDirection, start)参数criteria   字符串,包含用于搜索的指定列名、比较操作符和值的语句。SkipRows    可选,长整型值,其默认值为零。它指定当前行或 start 书签的位移以开始搜索。searchDirection    可选的 SearchDirectionEnum 值,指定搜索应从当前行还是搜索方向上的下一个有效行开始。其值可为 adSearchForward 或 adSearchBackward。搜索停止在记录集的开始还是末尾则取决于 searchDirection 值。start    可选,变体型书签,用作搜索的开始位置。说明criteria 中的“比较操作符”可以是“>”(大于)、“<”(小于)、“=”(等于)或“like”(模式匹配)。  criteria 中的值可以是字符串、浮点数或者日期。字符串值以单引号分隔(如“state = 'WA'”)。日期值以“#”(数字记号)分隔(如“start_date > #7/22/97#”)。如“比较操作符”为“like”,则字符串“值”可以包含“*”(某字符可出现一次或多次)或者“_”(某字符只出现一次)。(如“state like M_*”与 Maine 和 Massachusetts 匹配。)
      

  7.   

    只能搜索第一个符合要求的记录,第二个就不行了阿,HELP~~~
      

  8.   

    Find 方法
          搜索 Recordset 中满足指定标准的记录。如果满足标准,则记录集位置设置在找到的记录上,否则位置将设置在记录集的末尾。语法Find (criteria, SkipRows, searchDirection, start)参数criteria   字符串,包含指定用于搜索的列名、比较操作符和值的语句。SkipRows    可选,长整型值,其默认值为零,它指定当前行或 start 书签的位移以开始搜索。searchDirection    可选的 SearchDirectionEnum 值,指定搜索应从当前行还是下一个有效行开始。其值可为 adSearchForward 或 adSearchBackward。搜索是在记录集的开始还是末尾结束由 searchDirection 值决定。start    可选,变体型书签,用作搜索的开始位置。说明criteria 中的“比较操作符”可以是“>”(大于)、“<”(小于)、“=”(等于)、“>=”(大于或等于)、“<=”(小于或等于)、“<>”(不等于)或“like”(模式匹配)。 criteria 中的值可以是字符串、浮点数或者日期。字符串值以单引号分界(如“state = 'WA'”)。日期值以“#”(数字记号)分界(如“start_date > #7/22/97#”)。如“比较操作符”为“like”,则字符串“值”可以包含“*”(某字符可出现一次或多次)或者“_”(某字符只出现一次)。(如“state like M_*”与 Maine 和 Massachusetts 匹配。)。
      

  9.   

    to wangluonanhai(网络男孩) 
    老大,上面都发过了
      

  10.   

    Find (criteria, SkipRows, searchDirection, start)老大,不是有個start參數嗎,找到一條後把這條的下一條記錄的標簽賦給它不就繼續找了嘛