Changing ADO to SDAC and parameters

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Zelius
Posts: 5
Joined: Tue 24 Aug 2010 10:28

Changing ADO to SDAC and parameters

Post by Zelius » Tue 24 Aug 2010 10:35

Hello! I use demo version to change ADO by SDAC. But have trouble with auto describing parameters. I use code:

Code: Select all

function TdmData.ExecQueryPrm( const aSQL: String; var aParams: Variant): Integer;
var i: Integer;
begin
  with TADOCommand.Create(nil) do
  try
    Connection := acData;
    CommandText := aSQL;
    Parameters.Refresh;
    Execute( Result, aParams);
    for i := 0 to Parameters.Count-1 do
      if Parameters.Items[i].Direction in [ pdOutput, pdInputOutput] then
        aParams[i] := Parameters.Items[i].Value;
  finally
    Free;
  end;
end;
Then i have changed Execute( Result, aParams) to

Code: Select all

    for i := 0 to Params.Count-1 do
      if Params.Items[i].ParamType in [ ptInput, ptInputOutput] then
        Params.Items[i].Value := aParams[i];
   Execute;
And it does not work because SDAC can not describe parameters for expression like 'exec p_Tasks_Decline :ID, :Text'. Is it true? How should i change code? I use this approach very often in many places.
Thanks

Dimon
Devart Team
Posts: 2885
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Wed 25 Aug 2010 10:10

The TMSQuery.Options.DescribeParams property provides automatic parameters describing when a statement is prepared. To solve the problem set this option to True.

Post Reply