Page 1 of 1

exec [sys].sp_describe_undeclared_parameters

Posted: Wed 14 Oct 2015 14:07
by Ludek
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.

Re: exec [sys].sp_describe_undeclared_parameters

Posted: Wed 14 Oct 2015 14:24
by Ludek
hmh, apparently do i need to set also the datatype.

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

I don't need anything more.

Re: exec [sys].sp_describe_undeclared_parameters

Posted: Fri 16 Oct 2015 12:01
by AlexP
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.