I wanted to log the exceptions into a database table and was using SQLite
I can add data into the table using the AddData call below
procedure TForm1.btn1Click(Sender: TObject);
begin
AddData('btn1Click');
end;
procedure TForm1.AddData(aString: String);
begin
tb1.Append;
tb1.FieldByName('test').AsString := aString;
tb1.Post;
tb1.Close;
con1.close();
con1.Open();
tb1.Open();
end;
but I cant get the SQLite database to add data from the Application.OnException call
procedure TForm1.FormCreate(Sender: TObject);
begin
con1.Open();
if con1.Connected then begin
qry1.SQL.Clear;
qry1.SQL.Add
('Create Table if not Exists TEST(test char(255));');
qry1.ExecSQL;
tb1.Open();
end;
Application.OnException := AppException;
end;
procedure TForm1.AppException(Sender: TObject; e: Exception);
begin
AddData(e.Message);
Application.ShowException(e);
end;
procedure TForm1.btn2Click(Sender: TObject);
begin
raise Exception.Create('Error Message');
end;
using the debugger looks like it adds the line but it seems to delete itself
like its in a transaction and it auto rolls back
does anyone know why this isn't posting
full code here
http://ift.tt/1PjY3Kq
Aucun commentaire:
Enregistrer un commentaire