Invalid parameter type



I create very simple test application to test one of our customer issue.

Can any ADO expert tell me why I get "Invalid Parameter Type" error at
ExecProc? If I create those parameters at design time, it runs ok at one
machine without error, it gets the same error message in another machine.
Both machine are Windows XP with MDAC 2.8 installed. What am I missing?

Thanks, Zhuo

*************************Simple code*********************
procedure TForm1.Button1Click(Sender: TObject);
var
pm1, pm2, pm3 : TParameter;
begin
//spTotalsProcExists is TADOStoreProc which is linked to an
ADOConnection. All set up are OK.
spTotalsProcExists.ProcedureName :='dbo.f_object_id';
spTotalsProcExists.Parameters.Clear;
pm1 :=spTotalsProcExists.Parameters.CreateParameter( 'p_object_name',
ftString, pdInput, 256, 'spem_SetTotal_dly_sys_ttl');
pm2 :=spTotalsProcExists.Parameters.CreateParameter('p_object_type',
ftString, pdInput, 1, 'F');
pm3 := spTotalsProcExists.Parameters.CreateParameter('f_object_id',
ftInteger, pdReturnValue,0, 0);

with spTotalsProcExists do begin
parameters.ParamByName('p_object_name').Value :=
'spem_SetTotal_dly_sys_ttl';
parameters.ParamByName('p_object_type').Value := 'F';

ExecProc; //get error here

if (Parameters.ParamByName('f_object_id').Value <> 0) then
showmessage('Not zero')
else
showmessage(' zero');
end;
end;


.


Quantcast