AfterUpdateExecute/BeforeUpdateExecute of TOraQuery with single row refresh
Posted: Wed 02 Jan 2008 10:01
hello,
we use TOraQuery (Odac for Delphi 2007, version 6.10.1.10 02.08.07) to query and manipulate data. after an insert or update we use single row refresh for refreshing the grid belonging to the dataset. to specify the query parameters for the single row refresh we use the BeforeUpdateExecute event :
if (StatementTypes = [stRefresh]) then begin Params.ParamByName('ARTKMK_ID').AsInteger:=qGetArtkMKCur.Params.ParamByName('ARTKMK_ID').AsInteger;
qGetArtkMKCur.Params.ParamByName('ARTKMK_ID').clear;
end;
the ARTKMK_ID mentioned above is preserved during AfterUpdateExecute:
if (StatementTypes [stRefresh]) then qGetArtkMKCur.Params.ParamByName('ARTKMK_ID').AsInteger:=Params.ParamByName('ARTKMK_ID').AsInteger;
ARTKMK_ID is a returning value from the insert/update statement and is the id of the newly inserted or updated row.
this works always fine for the first inserted or updated row. but if i try to insert/update a second record (immediatley after inserting/updating the first record), the AfterUpdateExecute is not called and the BeforeUpdateExecute is called only one times (instead of one times for StatementTypes = [stInsert] and one times for StatementTypes = [stRefresh]). thus, for the second insert/update the id of the new record is not preserved and even it would be reserved, the parameter for the single row refresh is not set and the refresh fails because it finds more than one record.
after executing a full refresh of TOraQuery, single row refresh for inserting/updating a row works one times and fails again for the second row.
have i misunderstood the functionality of AfterUpdateExecute/BeforeUpdateExecute or is this a bug?
thx and br, klaus eckhardt.
we use TOraQuery (Odac for Delphi 2007, version 6.10.1.10 02.08.07) to query and manipulate data. after an insert or update we use single row refresh for refreshing the grid belonging to the dataset. to specify the query parameters for the single row refresh we use the BeforeUpdateExecute event :
if (StatementTypes = [stRefresh]) then begin Params.ParamByName('ARTKMK_ID').AsInteger:=qGetArtkMKCur.Params.ParamByName('ARTKMK_ID').AsInteger;
qGetArtkMKCur.Params.ParamByName('ARTKMK_ID').clear;
end;
the ARTKMK_ID mentioned above is preserved during AfterUpdateExecute:
if (StatementTypes [stRefresh]) then qGetArtkMKCur.Params.ParamByName('ARTKMK_ID').AsInteger:=Params.ParamByName('ARTKMK_ID').AsInteger;
ARTKMK_ID is a returning value from the insert/update statement and is the id of the newly inserted or updated row.
this works always fine for the first inserted or updated row. but if i try to insert/update a second record (immediatley after inserting/updating the first record), the AfterUpdateExecute is not called and the BeforeUpdateExecute is called only one times (instead of one times for StatementTypes = [stInsert] and one times for StatementTypes = [stRefresh]). thus, for the second insert/update the id of the new record is not preserved and even it would be reserved, the parameter for the single row refresh is not set and the refresh fails because it finds more than one record.
after executing a full refresh of TOraQuery, single row refresh for inserting/updating a row works one times and fails again for the second row.
have i misunderstood the functionality of AfterUpdateExecute/BeforeUpdateExecute or is this a bug?
thx and br, klaus eckhardt.