Einzelnen Beitrag anzeigen

shidap

Registriert seit: 28. Jan 2005
Ort: Wiesbaden
6 Beiträge
 
Delphi 6 Professional
 
#4

Re: Exception EAccessViolation Form Free

  Alt 1. Feb 2005, 13:24
If the user does not have the report INI, it will prompted with a login, otherwise it will run the report automatically and (should) end the application upon completion.

Delphi-Quellcode:
procedure Tfrmsaselogin.FormCreate(Sender: TObject);
var Connstr : String;
strFTPReportDIR : String;
strUserId : ShortString;
begin
     Scaleform(self);
     DateSeparator := '-';
     ShortDateFormat := 'yyyy' + DateSeparator + 'mm' + DateSeparator + 'dd';
     ThousandSeparator := '.';
     DecimalSeparator := ',';

     try
         SaseAdoConn.Open
     except on E:Exception do
        begin
             Screen.Cursor := crDefault;
             SaseAdoConn := Nil;
             ShowMessage(E.Message);
        end;
     end;

     MyIniFile := TIniFile.Create('./SASE_Report.ini');
     logintry:=0;
     logon_q.DatabaseName:= SASEDB.DatabaseName;

     //Check if the .ini file exists or not
     If FileExists('./SASE_Report.ini') then
     begin
          strFTPReportDIR := MyInifile.ReadString('FTPReportDirectory', 'FTPReportDIR', '');
          If Trim(strFTPReportDIR) <> 'then
          begin
              MyInifile.Free;
              strUserId := 'Automatik';
              strUserId:=LowerCase(strUserId);
              strAccessLevel := '0';
              // Go straight to the Report Generator
              StartGenerateReports(Application,SaseAdoConn,-1, Now, Now, '');

              // when the user exits the Form "StartGenerateReports" the Application should end.
              If Assigned(frmsaselogin) then
                 frmsaselogin.Free;

              // I tried closed and Exit but the application remainded in the background

          end;
     end;

     // If there is no INI show the User the Login screen and let them enter their password

     USID_EB.Text := GetSystemUserName;
end;
  Mit Zitat antworten Zitat