Einzelnen Beitrag anzeigen

Helmeru

Registriert seit: 29. Aug 2003
Ort: Vielbach
9 Beiträge
 
Delphi 2006 Architect
 
#1

ADO Recordset schliessen läuft auf Fehler

  Alt 23. Mai 2006, 10:20
Datenbank: SQL Server 2005, Oracle 9i • Zugriff über: ADO, DOA
Delphi-Quellcode:
procedure TfrmImport.splFahrzeuge_importieren;
var
  i: Integer;
  aSPLRS : Recordset;
  s : string;
begin
  aSPLRS := CoRecordset.Create;
  oraSPLSess.LogonUsername := 'x';
  oraSPLSess.LogonPassword := 'y';
  oraSPLSess.Connected := True;

  oraVmsAppl.Open;

  if oraVmsAppl.RecordCount > 0 then
  begin
    oraVmsAppl.First;
    try
      aSPLRS.Open('SELECT * FROM dbo.tblSPLAppl', aVMSConn, adUseClient, adLockOptimistic, adCmdtext);
      sqlDelete.CommandText := 'TRUNCATE TABLE tblSPLAppl';
      try
        sqlDelete.Execute;

        for i := 0 to oraVMSAppl.recordcount - 1 do
        begin
          aSPLRS.AddNew(EmptyParam, Emptyparam);
          aSPLRS.Fields['BCHLD'].Value := oraVmsApplBCHLD.AsString;
          aSPLRS.Fields['VVEHNO'].Value := oraVmsApplVVEHNO.AsInteger;
          aSPLRS.Fields['VVM'].Value := oraVmsApplVVM.AsString;
          aSPLRS.Fields['VTYP'].Value := oraVmsApplVTYP.AsString;
          aSPLRS.Fields['VMODEL'].Value := oraVmsApplVMODEL.AsString;
          aSPLRS.Fields['VFROM'].Value := oraVmsApplVMONF.AsString + '.' + oraVmsApplVYEARF.AsString;
          aSPLRS.Fields['VTO'].Value := oraVmsApplVMONT.AsString + '.' + oraVmsApplVYEART.AsString;
          aSPLRS.Fields['VCDM'].Value := oraVmsApplVCDM.AsFloat;
          aSPLRS.Fields['VHP'].Value := oraVmsApplVHP.AsInteger;
          aSPLRS.Fields['VKW'].Value := oraVmsApplVKW.AsFloat;
          aSPLRS.Fields['VSPLNO'].Value := oraVmsApplVSPLNO.AsInteger;
          aSPLRS.Fields['VRELNO'].Value := oraVmsApplVRELNO.AsInteger;
          aSPLRS.Update(EmptyParam, EmptyParam);
          
          oraVmsAppl.Next;
        end;
      except
        slLog.Add('Löschen der SPL Fahrzeugtabelle fehlgeschlagen');
      end;
    finally
      aSPLRS.Close;
      [b]Hier läuft die Prozedur auf Fehler, warum ?[/b]
      [b]-- Operation is not allowed in this context --[/b]
    end;
  end;

  oraVmsAppl.Close;
  oraSPLSess.Connected := False;

end;
Beim Schliessen des Recordsets kommt die oben fettgedruckte fehlermeldung, hat jemand eine Idee was ich falsch mache.

Gruss
Uwe Helmer
Uwe Helmer
  Mit Zitat antworten Zitat