Hello,
How to assign onScriptError event when UniScript is created from the code ?
For example:
UScript:=TUniScript.Create(self);
UScript.Connection:=UniConnection1;
UScript.onScriptError := ????
Regards
Michal
UniScript and onScriptError Event from code
Re: UniScript and onScriptError Event from code
Hello,
You need to declare and implement the OnError method in the following way:
You need to declare and implement the OnError method in the following way:
Code: Select all
TForm1 = class(TForm)
UniConnection1: TUniConnection;
...
public
procedure UniScriptonError(Sender: TObject; E: Exception; SQL: string; var Action: TErrorAction);
.......
procedure TForm4.UniScriptonError(Sender: TObject; E: Exception; SQL: string; var Action: TErrorAction);
begin
//............................
end;
var
UniScript: TUniScript;
begin
UniScript := TUniScript.Create(nil);
UniScript.Connection := UniConnection1;
UniScript.OnError := UniScriptonError;Re: UniScript and onScriptError Event from code
Hello,
Thanks.
I tried do it like you wrote. The compiler was showing, that I had a bug in parameters at line
UniScript.OnError := UniScriptonError;
I had to enable huge strings for these procedures like bellow:
public
{$H+}
procedure UniScriptonError(Sender: TObject; E: Exception; SQL: string; var Action: TErrorAction);
{$H-}
.......
{$H+}
procedure TForm4.UniScriptonError(Sender: TObject; E: Exception; SQL: string; var Action: TErrorAction);
begin
//............................
end;
{$H-}
Regards
Michal
Thanks.
I tried do it like you wrote. The compiler was showing, that I had a bug in parameters at line
UniScript.OnError := UniScriptonError;
I had to enable huge strings for these procedures like bellow:
public
{$H+}
procedure UniScriptonError(Sender: TObject; E: Exception; SQL: string; var Action: TErrorAction);
{$H-}
.......
{$H+}
procedure TForm4.UniScriptonError(Sender: TObject; E: Exception; SQL: string; var Action: TErrorAction);
begin
//............................
end;
{$H-}
Regards
Michal
Re: UniScript and onScriptError Event from code
This option is enabled by default. If you have disabled this option manually, in this case you need to use the {$H} directive.
Re: UniScript and onScriptError Event from code
Thanks
Regards
Michal
Regards
Michal
Re: UniScript and onScriptError Event from code
You are welcome. Feel free to contact us if you have any further questions about UniDAC.