Hallo,
ich habe ein Problem mit dem Aufruf einer Function.
Die Function sieht so aus:
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42:
| function TReg.GetDBNames : TStrings; var dbnames : TStrings; orahome : String; tnsnames : String; f : textfile; svalue : String; nlength : integer; begin orahome := self.getOraHome; tnsnames := orahome + '\network\ADMIN\tnsnames.ora';
try if(FileExists(tnsnames)) then begin AssignFile(f,tnsnames); Reset(f); dbnames := TStringList.Create; while not eof(f) do begin readln(f,svalue); svalue := Trim(svalue); nlength := Length(svalue);
if ((nlength > 0) and (svalue[1] <> '(') and (svalue[1] <> '#') and (svalue[nlength] = '=')) then begin svalue := StringReplace(svalue,' =','',[rfReplaceAll, rfIgnoreCase]); dbnames.Add(svalue); end; end;
end else MessageDlg('Datei' + tnsnames + ' konnet nicht gefunden werden.',mtError, [mbOK], 0);
finally Result := dbnames; dbnames.Free; end; end; |
Hier wird die Function aufgerufen:
Delphi-Quelltext
1: 2: 3: 4: 5: 6: 7: 8: 9: 10:
| procedure TForm1.mCBDatenbankChange(Sender: TObject); begin self.mCBDatenbank.Clear; try self.mCBDatenbank.Items.AddStrings(reg.GetDBNames); except on E:Exception do MessageDlg(E.Message,mtInformation, [mbOK], 0); end; end; |
Wenn ich die Function aufrufe kommt immer folgende Exception am Schluß:
"Project ... raised too many consecutive exceptions: 'access vioalation at 0x00000000: read of adress
0x00000000'. Process stopped. Use step or Run to continue"
Was ist denn in dem Quellcode falsch? und was bedeuted diese Exception?
Steffen
Moderiert von
Christian S.: Code- durch Delphi-Tags ersetzt.