Reputation: 15
In run this Code in Delphi. It works fine if I run this in "Debug mode", but when I am build this project in Release Mod I got a Access Violation Exception. I really dont know why...
Code:
if not SQLConnection.Connected then begin
DatabaseValues := TStringList.Create;
try
IniFile := TPataxPlusGlobal.ClientIniFilename;
if FileExists(IniFile) then begin
TIniFileHelper.ReadSectionValuesFromIniFile(INI_SECTION_DATABASE, DatabaseValues, IniFile);
SQLConnection.TxOptions.AutoCommit := cbAutoCommit.Checked;
SQLConnection.Params.Add('Server=' + DatabaseValues.Values['Server']);
SQLConnection.Params.Add('Database=' + 'pps');
SQLConnection.Params.Add('User_Name=' + DatabaseValues.Values['Nutzer']);
SQLConnection.Params.Add('Password=' + TPataxPlusUtil.DecryptStr(DatabaseValues.Values['Passwort']));
SQLConnection.Params.Add('Port=' + DatabaseValues.Values['Port']);
SQLConnection.Open; //This line throw the Exception
end;
finally
DatabaseValues.Free;
end;
end;
And this is the Exception:
Access Violation at address 00000000 in module 'PataxPlusClient.exe' read of address 00000000
Upvotes: 0
Views: 506
Reputation: 1
what component used for connection?
also check line
SQLConnection.Params.Add('Password=' + TPataxPlusUtil.DecryptStr(DatabaseValues.Values['Passwort']));
has the connection component been created?
Upvotes: -1