I am programmatically creating a database connection object inside a simple procedure (not a method in a class).
mydb:= TUniConnection.Create(nil);
mydb.Database:= knowledge_db_name;
mydb.LoginPrompt:= False;
mydb.Username:= aaa;
mydb.Password:= bbb;
now I need to handle errors and disconnections with other procedures. When I try to do:
mydb.OnError:= OnConnectionError;
mydb.OnConnectionLost:= OnConnectionLost;
The compiler tells me
[DCC Error] test.pas(373): E2009 Incompatible types: 'method pointer and regular procedure'
How can I work around this? Here are the definitions of the event procedures:
procedure OnConnectionError(Sender: TObject; E: EDAError; var Fail: Boolean);
procedure OnConnectionLost(Sender: TObject; Component: TComponent; ConnLostCause: TConnLostCause; var RetryMode: TRetryMode);