Page 1 of 1

TOraUpdateSQL

Posted: Thu 14 May 2009 09:42
by albourgz
Dear all,

I have a TOraQuery with a TOraUpdateSQL.
The TOraQuery is closed (non active)
I would like to execute the delete statement of the TOraUpdateSQL.

To run
OraQuery->Params["ID"]->AsInteger=i;
The Delete statement has to be prepared for this, but how do I prepare only the delete statement (and run only the delete statement, not the update statement for example)?

Regards,
Alain

Posted: Mon 18 May 2009 08:04
by Plash
You should call the Apply method of TOraUpdateSQL to execute a statement:

Code: Select all

  OraUpdateSQL->Apply(ukDelete);
To assing parameter values, use the BeforeUpdateExecute event of TOraQuery:

Code: Select all

procedure TForm1.OraQuery1BeforeUpdateExecute(Sender: TDataSet;
  StatementTypes: TStatementTypes; Params: TDAParams);
begin
  Params.ParamByName('ID').AsInteger := 1;
end;
In the current ODAC version you can use the Apply method only when TOraQuery is opened. In the next ODAC build we will fix this problem. So that the Apply method can be used when the query is closed.