Error Position in TOraScript

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Rodrigo Cesar

Error Position in TOraScript

Post by Rodrigo Cesar » Tue 07 Jun 2005 18:16

Hi,
I would like to know if I can get the position error in TOraScript, like the GetErrorPos on the TOraQuery.
I'm using Odac 3.80.0.49 for Delphi 5.
Thanks,

Rodrigo Cesar

Alex
Posts: 655
Joined: Mon 08 Nov 2004 08:39

Post by Alex » Fri 10 Jun 2005 07:39

You can use one of the following solutions :

Code: Select all

OraScript1.DataSet.GetErrorPos(...)
or

Code: Select all

OraScript1.ErrorOffset
for more information pls. see "TOraScript.ErrorOffset" and "TOraDataSet.GetErrorPos" topic in ODAC help.

Rodrigo Cesar

Post by Rodrigo Cesar » Fri 10 Jun 2005 20:15

The GetErrorPos(...) result a Access Violation error. In debug I can see the DataSet property is "nil", no exists.
The ErrorOffset result a number, but I dont now what I can do with this. The Delphi help dont explains how I work with this. In the demos have one example?
Thanks,

Rodrigo Cesar

Alex
Posts: 655
Joined: Mon 08 Nov 2004 08:39

Post by Alex » Tue 14 Jun 2005 12:19

To use TOraScript.DataSet property you need to set it up before with instance of any TOraDataSet descendant. e.g.

Code: Select all

//OraQuery1 : TOraQuery; - placed on the form at design-time
procedure TForm1.FormCreate(Sender: TObject);
begin
  OraScript1.DataSet := OraQuery1;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
  OraScript1.Execute;
end;
procedure TForm1.OraScript1Error(Sender: TObject; E: Exception;
  SQL: String; var Action: TErrorAction);
var
  Row,Col : integer;
begin
  OraScript1.DataSet.GetErrorPos(Row,Col);
   . . .
end;

Rodrigo Cesar

Post by Rodrigo Cesar » Thu 23 Jun 2005 21:02

I try it, but dont works... when I make de Execute on OraScript get a error "DataSet is not prepared".
I need make some else on the OraQuery?

Alex
Posts: 655
Joined: Mon 08 Nov 2004 08:39

Post by Alex » Fri 24 Jun 2005 13:29

You are right - there is a bug in TOraScript.ExecuteNext function in ODAC 3.90 or lower version. The fix will be included in the next ODAC 3 build.

Post Reply