BeforeInsertExecute BeforeDeleteExecute ?

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
rept
Posts: 20
Joined: Mon 30 Oct 2006 09:15
Location: Belgium

BeforeInsertExecute BeforeDeleteExecute ?

Post by rept » Mon 18 Oct 2010 14:29

The event BeforeUpdateExecute exists and it allows me to set parameters, which is great.

However I need to do the same thing for insert and delete but those events don't seem to exist???

How can I fill in some parameters with SQLInsert and SQLDelete? Most parameters are taken from the dataset, such as the ID, but there are some parameters that I need to fill in myself (for example the user ID).

AndreyZ

Post by AndreyZ » Wed 20 Oct 2010 08:28

Hello,

The BeforeUpdateExecute event occurs before executing insert, delete, update, lock and refresh operations.
Here is an example of using it:

Code: Select all

procedure TMainForm.MSQueryBeforeUpdateExecute(Sender: TCustomMSDataSet;
  StatementTypes: TStatementTypes; Params: TMSParams);
begin
  if stInsert in StatementTypes then
    //your code
  else
  if stDelete in StatementTypes then
    //your code
  else
  if stUpdate in StatementTypes then
    //your code
end;

rept
Posts: 20
Joined: Mon 30 Oct 2006 09:15
Location: Belgium

Post by rept » Thu 21 Oct 2010 22:26

Great, works perfect!

AndreyZ

Post by AndreyZ » Fri 22 Oct 2010 05:32

Feel free to contact us if you have any further questions about SDAC.

Post Reply