I want to execute a stored procedure from my MS SQL server database base but when trying to execute the code below the error message "List index out of bounds (0)" appears.The procedure i executed perfectly when i remove its parameters and hard code the input as following code
tem:tsqlstoredproc
.................................
with tem do
begin
p1:=tparam.Create(params,ptInput);
StoredProcName:='getUniqueInstance';
Parambyname('@val').AsInteger:=TID;
params.Clear;
params.CreateParam(ftinteger, '@val', ptInputOutput);
params.ParamByName('@val').AsInteger:=TID;
execproc;//<- error occurs here
end;
tem:tsqlstoredproc
.................................
with tem do
begin
p1:=tparam.Create(params,ptInput);
StoredProcName:='getUniqueInstance';
Parambyname('@val').AsInteger:=TID;
params.Clear;
params.CreateParam(ftinteger, '@val', ptInputOutput);
params.ParamByName('@val').AsInteger:=TID;
execproc;//<- error occurs here
end;