哪位哥哥用过.recordset.find()呀,给小弟讲解一下4个参数都是什么意思呀?
最好给个例子。原型: procedure Find(const Criteria: WideString; SkipRecords: Integer;
      SearchDirection: SearchDirectionEnum; Start: OleVariant); safecall;

解决方案 »

  1.   

    没必要用它吧,用QUERY来搜吧
      

  2.   

    Delphi已经把原生ADO对象的RecordSet.Find方法封装好了,就是ADOQuery1.Locate()和ADOQuery1.Lookup()让程序员在结果数据集中搜寻特定的数据,所以你没有必要直接使用Find方法,直接用Locate()和Lookup()就轻松搞定了,而且使用起来也比较容易!
      

  3.   

    Delphi已经把原生ADO对象的RecordSet.Find方法封装好了,就是ADOQuery1.Locate()和ADOQuery1.Lookup()让程序员在结果数据集中搜寻特定的数据,所以你没有必要直接使用Find方法,直接用Locate()和Lookup()就轻松搞定了,而且使用起来也比较容易!
    同意!!!
      

  4.   

    Delphi已经把原生ADO对象的RecordSet.Find方法封装好了,就是ADOQuery1.Locate()和ADOQuery1.Lookup()让程序员在结果数据集中搜寻特定的数据,所以你没有必要直接使用Find方法,直接用Locate()和Lookup()就轻松搞定了,而且使用起来也比较容易!
    同意!!!
    呵呵
      

  5.   

    Locate和lookup我当然会用我想要的就是.recordset.find()的方法而且我现在要做的东西Locate和lookup替换不了
      

  6.   

    Recordset.Find Criteria, [SkipRows], [SearchDirection], [Strat]
    SkipRows是一个数字,表示在开始查找记录前跳过的行数。缺省为0,查询从当前行开始。
    SearchDirection可以是adSearchForward,表示向前搜索记录;或者adSearchBackward,表示向后搜索记录。
    Start是一个书签,指出开始查找记录的位置。
    如果打开相应的记录,当前指针将位于匹配的记录上,如果没有找到记录,那么将位于下面两个位置中的一个:
    · 如果是向前搜索,则位于记录集末尾位置的后面,EOF被设置为True。
    · 如果是向后搜索,则位于记录集开始位置的前面,BOF被设置为True。
    使用书签保存位置
    如果没有找到相应的记录,记录的重新定位可以由书签轻松解决,因为可以为当前位置制作书签,如果在查找记录过程中没有找到所需的记录,那么再移回到上次保存的位置。
      

  7.   

    juliens(星星球愛思纯^_^) 可以给个调用的列子嘛?我掉用的时候老是出类型不匹配的错误。
      

  8.   

    table1.Locate(字段,值,[loPartialKey]);
      

  9.   

    if ADOQuery1.locate('date;time',VarArrayOf(['2001-29-11','08:00']),[loCaseInsensitive])=true then
    如果找到記錄返回true;
    給分吧,老兄,肯定可以 
      

  10.   

    楼上的,你有没有看懂我的意思呀要是用locate我还用到这来问,我还没菜到你想的那个地步吧我在封装控件的时候用到了recordset.find,因为我定义了一个
    rs: _RecordSet;
      

  11.   

    呵呵,俺参加了软件开发交流群,也帮Up之!建议多看Delphi的帮助!!!
      

  12.   

    ADOTable1.Recordset.Find('uname',0,0,0);
    编译能通过,运行就出错
      

  13.   

    直接用Locate()和Lookup()就轻松搞定了
      

  14.   

    我都说了是在封装ActiveX控件,有那么容易我还用问嘛?
      

  15.   

    自己顶在csdn连续问了几个问题,没一个能解决的,真tnnd郁闷高手都哪里去了
      

  16.   

    pick it in delphi or ado helpParameters
    ADO supports four arguments for the Find method, but the last three arguments are optional and have default values as noted below: Criteria 
    This BSTR parameter specifies the criteria used for locating or seeking to a record in a Recordset object. 
    SkipRecords 
    This optional parameter specifies a Long expression that indicates the number of records to skip (whether to skip the current record) when locating a record in a Recordset object. The default value for this argument is 0 (don't skip the current record). The first time a Find method is used, this argument is usually set to 0 (the default). On subsequent calls to this method to seek other records that meet the specified condition, this argument would normally be set to 1, to skip one record forward before finding the next record that matches the search Criteria. A negative value for this parameter is not supported by the Microsoft® OLE DB Provider for AS/400 and VSAM. 
    SearchDirection 
    This optional parameter is an enumeration that specifies the direction for the search. It can be one of the following enumerated values for SearchDirectionEnum: Enumeration Value Description 
    adSearchForward 0 Search forward from the current record. 
    AdSearchBackward 1 Search backward from the current record. This option is not supported by the OLE DB Provider for AS/400 and VSAM. 
    This optional argument defaults to adSearchForward. Start 
    This optional parameter specifies the starting location for a search, which can be a book or an enumeration indicating the current, first, or last record in a Recordset object. This argument is a Variant and can be either a book or one of the following enumerated values for BookEnum: Enumeration Value Description 
    adBookCurrent 0 The current record. 
    AdBookFirst 1 The first record. 
    AdBookLast 2 The last record. 
      

  17.   

    你可以看VCL源代码。方法如下:
    1、输入:
    ADOTable1.Locate(),按住Ctrl单击“Locate”,从而进入TCustomADODataSet.Locate
    2、在TCustomADODataSet.Locate中进入TCustomADODataSet.LocateRecord
    3、在TCustomADODataSet.LocateRecord中搜索“FLookupCursor.Find”,然后你就知道怎么用了。————————————————————————————————————
    宠辱不惊,看庭前花开花落,去留无意;毁誉由人,望天上云卷云舒,聚散任风。
    ————————————————————————————————————
      

  18.   

    谁给个调用的例子呀只要一行就可以了。我这样调用
    ADOTable1.Recordset.Find('uname',0,0,0);
    编译能通过,运行就出错
      

  19.   

    谁给个调用的例子呀只要一行就可以了。我这样调用
    ADOTable1.Recordset.Find('uname',0,0,0);
    编译能通过,运行就出错
      

  20.   

    lxpbuaa(桂枝香在故国晚秋) 
    我照你的方法试了一下,不出错了可是没有效果呀,为什么呢?
        ADOTable1.Recordset.Find(GetFilterStr(ADOTable1.FieldByName('deptno'), 'ya1', false), 0,
               adSearchForward, EmptyParam);
        Edit1.Text := ADOTable1.FieldValues['uname'];
    得到的是第一条记录
      

  21.   

    lxpbuaa(桂枝香在故国晚秋) 
    我照你的方法试了一下,不出错了可是没有效果呀,为什么呢?
        ADOTable1.Recordset.Find(GetFilterStr(ADOTable1.FieldByName('deptno'), 'ya1', false), 0,
               adSearchForward, EmptyParam);
        Edit1.Text := ADOTable1.FieldValues['uname'];
    得到的是第一条记录
      

  22.   

    if LckTable.Recordset.RecordCount>0 then
          begin
            LckTable.Recordset.MoveFirst;
            LckTable.Recordset.Find('lockid='''+s1+'''',0,1,1);
          end;
      

  23.   

    aiirii老大,你的代码编译不出错,可是也是什么也不做呀,还是停留在第一条记录
      

  24.   

    ADOTable1.Recordset.Find('username='''+'exp'+'''',0,1,1);
        Edit1.Text := ADOTable1.FieldValues['userdesc'];
    如果find起作用了的话,Edit1.Text应该是“在建工程”。可是现在仍然是“应收”。aiirii大哥,可不可以把这个帖子置顶呀。
      

  25.   

    var
      LookupCursor: _Recordset;
    begin
      LookupCursor := ADOTable1.Recordset.Clone(1);
      LookupCursor.Find(GetFilterStr(ADOTable1.FieldByName('deptno'), 'ya1', false), 0, adSearchForward, EmptyParam);
      if not LookupCursor.EOF then
        ADOTable1.Recordset.Book := LookupCursor.Book;
      ADOTable1.Resync([rmExact, rmCenter]);
      Edit1.Text := ADOTable1.FieldValues['uname'];
    end;————————————————————————————————————
    宠辱不惊,看庭前花开花落,去留无意;毁誉由人,望天上云卷云舒,聚散任风。
    ————————————————————————————————————
      

  26.   

    终于ok了,揭帖多谢 lxpbuaa(桂枝香在故国晚秋) 和 aiirii