请问就是这样吗: ARecordSet.locate('ID',10,[]); 
出错信息:Type not allowed in OLE Automation call(编译时)
 

解决方案 »

  1.   

    错误依旧: 我的程序如下:    
         AConnection := CreateOleObject('ADODB.Connection');
         AConnection.Open('Driver={Microsoft Access Driver (*.mdb)};DBQ='+MyPath);
         ARecordSet := CreateOleObject('ADODB.RecordSet');
         ARecordSet.open( 'hello',AConnection,adOpenStatic,adLockOptimistic,adCmdText );
         ARecordSet.locate('ID','2',[]);
         ARecordSet.Fields['ID'] := 22;
         ARecordSet.Fields['FullName'] := '22';
         ARecordSet.Update;
      

  2.   

    在delphi为什么要直接用原生类呢?
    不是个好习惯
      

  3.   

    因为我只有Delphi4,没有Ado控件
      

  4.   

    ARecordSet.First;
    ARecordSet.Find('ID=10',0,1,0);
    if not ARecordSet.Eof then
    //找到了
      

  5.   

    无效的SAQ语句,期待'delete','insert','select'或'update'
      

  6.   

    ARecordSet := CreateOleObject('ADODB.RecordSet');
    ARecordSet.open( 'hello',AConnection,adOpenStatic,adLockOptimistic,adCmdText );
     ARecordSet.First;
     ARecordSet.Find('ID=2',0,1,0);
     if not ARecordSet.Eof then
     begin
         ARecordSet.Fields['ID'] := 22;
         ARecordSet.Fields['FullName'] := '22';
         ARecordSet.Update;//
     end;
    出现“无效的SQL语句”错误
      

  7.   

    ARecordSet := CreateOleObject('ADODB.RecordSet');
    ARecordSet.open( 'hello',AConnection,adOpenStatic,adLockOptimistic,adCmdText );
     ARecordSet.First;
     ARecordSet.Find('ID=2',0,1,0);
     if not ARecordSet.Eof then
     begin
         ARecordSet.Edit;
         ARecordSet.Fields['ID'] := 22;
         ARecordSet.Fields['FullName'] := '22';
         ARecordSet.Update;
     end;
      

  8.   

    程序老在这一句出错:
    ARecordSet.open('hello',AConnection,adOpenStatic,adLockOptimistic,adCmdText );
      

  9.   

    ARecordSet.open('select * from table',AConnection,adOpenStatic,adLockOptimistic,adCmdText );
      

  10.   

    又出错:
    Method “First” not supported by automation object
      

  11.   

    应该是MoveFirst,呵呵 ,我同意了,分怎么给你:zx_wang