Exec Stored procedure

Hi with Xdataset (dstSP.) i want to execute this SP :

Function TDMC.Exec_StoredProc(SPName, InputPar:String):String;
Var Params: TRDBParams;
AParam: TParam;
Begin
Try
Params:=TRDBParams.Create(Nil);
AParam:=TParam.Create(Params, ptInputOutput);
With AParam Do Begin
Name:='OutVal';
DataType:=ftString;
End;

InputPar:=Format('%d, ''%s''',[IntegerValue, StringValue]);

dstSP.Database.ExecSQL(
  Format('EXEC %s '', %s'', @OutVal OUTPUT',[SPName, InputPar]), Params);

dstSP.Open();
Result:=Params.ParamByName('OutVal').AsString;

Finally
AParam.Free();
Params.Free();
dstSP.Close();
End;
End;

  1. i receive and error on : TParam.Create(Params, ptInputOutput); ... 'invalid property'
    How can i set it correctly ?

  2. Inputpar are correctly set ?

InputPar:=Format('%d, ''%s''',[IntegerValue, StringValue]);
AND
dstSP.Database.ExecSQL(
Format('EXEC MyProc '', %s'', @OutVal OUTPUT',[InputPar]), Params);

TXDataset does not support parameters of types ptOutput or ptInputOutput. It always behaves as a dataset, if you want to return data from a stored procedure, you need to return all data as if it was a regular dataset, i.e., open the dataset and read the results directly from the fields.