function InitStoredProc(SP:TStoredProc;StoredProcName:string;CheckCount:integer):Boolean; var Params: TParams; begin Params := TParams.Create(nil); try if SP.Active then SP.Close; SP.StoredProcName:=StoredProcName; SP.CopyParams(Params); if CheckCount>=0 then //检查参数的个数是否符合前台程序的要求// begin if SP.Params.Count=CheckCount then result:=true else result:=false; end else begin result:=true; end; finally Params.Free; end; end;InitStoredProc(Sp1,'sp_myproc',-1); 然后获取Sp1中的Params就可以了。
var
Params: TParams;
begin
Params := TParams.Create(nil);
try
if SP.Active then
SP.Close;
SP.StoredProcName:=StoredProcName;
SP.CopyParams(Params);
if CheckCount>=0 then //检查参数的个数是否符合前台程序的要求//
begin
if SP.Params.Count=CheckCount then
result:=true
else
result:=false;
end
else
begin
result:=true;
end;
finally
Params.Free;
end;
end;InitStoredProc(Sp1,'sp_myproc',-1);
然后获取Sp1中的Params就可以了。