with  ADOTable1  do
  begin
    if locate('name',LabeledEdit1.Text,lo) then
      showMessage('查找成功!')
    else
      showMessage('查找失败')
    end;本人运行此代码老是这个错误:[Error] locat_guest.pas(51): '(' expected but ')' found
应如何修改啊

解决方案 »

  1.   

    少了一个;
    with  ADOTable1  do
    begin
      if locate('name',LabeledEdit1.Text,lo) then
        showMessage('查找成功!')
      else
        showMessage('查找失败');
    end;
      

  2.   

    locate的参数赋值方法不对参考delphi帮助
      

  3.   

    Delphi syntax:function Locate(const KeyFields: String; const KeyValues: Variant; Options: TLocateOptions): Boolean;C++ syntax:virtual bool __fastcall Locate(const AnsiString KeyFields, const System::Variant &KeyValues, Db::TLocateOptions Options);DescriptionCall Locate to search a dataset for a specific record and position the cursor on it.KeyFields is a string containing a semicolon-delimited list of field names on which to search.KeyValues is a variant array containing the values to match in the key fields. If KeyFields lists a single field, KeyValues specifies the value for that field on the desired record. To specify multiple search values, pass a variant array as KeyValues, or construct a variant array on the fly using the VarArrayOf routine. For example:with CustTable do
      Locate('Company;Contact;Phone', VarArrayOf(['Sight Diver', 'P', '408-431-1000']), [loPartialKey]);
    TLocateOptions Opts;
    Opts.Clear();
    Opts << loPartialKey;
    Variant locvalues[2];
    locvalues[0] = Variant("Sight Diver");
    locvalues[1] = Variant("P");
    CustTable->Locate("Company;Contact", VarArrayOf(locvalues, 1), Opts);Options is a set that optionally specifies additional search latitude when searching on string fields. If Options contains the loCaseInsensitive setting, then Locate ignores case when matching fields. If Options contains the loPartialKey setting, then Locate allows partial-string matching on strings in KeyValues. If Options is an empty set, or if the KeyFields property does not include any string fields, Options is ignored.Locate returns true if it finds a matching record, and makes that record the current one. Otherwise Locate returns false.Locate uses the fastest possible method to locate matching records. If the search fields in KeyFields are indexed and the index is compatible with the specified search options, Locate uses the index. Otherwise Locate creates a filter for the search.另外,楼主是你自己,不要搞混了
      

  4.   

    locate('name',LabeledEdit1.Text,[])
    改成这样试试,我一直都这么用