|
procedure TLYP.BizFormCreate(Sender: TObject);
var
vProc:TStoredProcDataSet;
vUserId:string;
vDepId:string;
lDataParam1, lDataParam2: TDataParam;
begin
vUserId := 'TEST';
vDepId := 'KJJYC';
vProc := TStoredProcDataSet.Create(self);
try
vProc.ConnectionString := 'DATABASEURL=Biz:JTTXMJTTSJK.DATABASE';
vProc.StoredProcName := 'dbo.proc_TotalExport';
vProc.Params.Clear();
lDataParam1 := vProc.Params.CreateParam(TFieldType.ftString, '@DepId', TParamType.ptInput);
lDataParam1.AsString :=vDepId;
lDataParam2 := vProc.Params.CreateParam(TFieldType.ftString, '@UserId', TParamType.ptInput);
lDataParam2.AsString :=vUserId;
vProc.Open();
finally
lDataParam1.Free();
lDataParam2.Free();
end;
数据库脚本
IF EXISTS (SELECT * FROM sysobjects WHERE name = 'proc_TotalExport' AND type = 'P')
DROP PROCEDURE proc_TotalExport
GO
Create Proc proc_TotalExport
(
@DepId VARCHAR(32),
@UserId VARCHAR(32)
)
AS
BEGIN
RETURN select * from kcb
END
GO
这个问题很急,请给与答复
|
|