exec [sys].sp_describe_undeclared_parameters

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Ludek
Posts: 296
Joined: Thu 12 Oct 2006 09:34

exec [sys].sp_describe_undeclared_parameters

Post by Ludek » Wed 14 Oct 2015 14:07

Hi, Can i somehow get rid of such command, when I execute a command using TMSSQL class?

I'm using it like this:

Code: Select all


FCommand := connection.CreateSQL as TMSSQL;
  try
    FCommand.ParamCheck := false;
    FCommand.Params.BeginUpdate;
    try
        param := FCommand.Params.ItemClass.Create(nil) as TParam;
        param.Value := 1;
        param.ParamType := ptInput;
        FCommand.Params.AddParam(param);
    finally
      FCommand.Params.EndUpdate;
    end;

    FCommand.SQL.Text := sql;

    FCommand.Execute;
  finally
    FCommand.Free;
  end;
Thanks, Ludek.

Ludek
Posts: 296
Joined: Thu 12 Oct 2006 09:34

Re: exec [sys].sp_describe_undeclared_parameters

Post by Ludek » Wed 14 Oct 2015 14:24

hmh, apparently do i need to set also the datatype.

param.DataType := VarTypeToDataType(VarType(1));

I don't need anything more.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: exec [sys].sp_describe_undeclared_parameters

Post by AlexP » Fri 16 Oct 2015 12:01

Hello,

If you don't disable ParamCheck, there will be no need to create parameter manually - it will be enough to set values for them (after specifying the SQL). If you create parameter by yourself, you should specify their DataType.

Post Reply