Web forum is in read-only mode. Login as active registered customer for write access
  Forum Search   New Posts New Posts

TWorkflowDB events, with another dataset

 Post Reply Post Reply
Author
BRANQUART Alexandre View Drop Down
New Member
New Member
Avatar

Joined: 21 Sep 2011
Posts: 8
Post Options Post Options   Quote BRANQUART Alexandre Quote  Post ReplyReply Direct Link To This Post Topic: TWorkflowDB events, with another dataset
    Posted: 09 May 2012 at 2:39am
Can you please give me an example of using events TWorkflowDB, with another dataset ?
Thanks.
Back to Top
Wagner R. Landgraf View Drop Down
TMS Support
TMS Support
Avatar

Joined: 18 May 2010
Posts: 2434
Post Options Post Options   Quote Wagner R. Landgraf Quote  Post ReplyReply Direct Link To This Post Posted: 09 May 2012 at 8:56am
You can check wsADO or wsDBX. They are actually descendants and do not use events but instead override methods, but the approach is the same. Here is a sample code for using TADODataset:

function TMyForm.WorkflowDBCreateQuery(Sender: TObject; SQL: string;
    var Dataset: TDataset; var Done: Boolean);
var
  Q: TADOQuery;
begin
  Q := TADOQuery.Create(nil);
  Q.Connection := FConnection;
  Q.Parameters.Clear;
  Q.SQL.Text := SQL;
  Dataset := Q;
  Done := true;
end;

function TMyForm.WorkflowDBAssignSQLParams(Sender: TObject; Dataset: TDataset;
    AParams: TParams; var Done: boolean);
var
  Q: TADOQuery;
  c: integer;
  AParam: TParam;
begin
  Q := TADOQuery(Dataset);
  Q.Parameters.ParseSQL(Q.SQL.Text, true);
 
  for c := 0 to Q.Parameters.Count - 1 do
  begin
    AParam := AParams.FindParam(Q.Parameters[c].Name);
    Q.Parameters[c].DataType := AParam.DataType;
    Q.Parameters[c].Direction := pdInput;
    Q.Parameters[c].Value := AParam.Value;
    if Q.Parameters[c].DataType in [ftString] then
      Q.Parameters[c].Size := Max(1, Length(VarToSTr(Q.Parameters[c].Value)));
  end;
  Done := true;
end;
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down