I
icemanpro
Unregistered / Unconfirmed
GUEST, unregistred user!
有一三层结构,在数据库上有一存储结构,客户端通过服务端的方式来调用这存储结构,但在运行时提示'@Bh' not found,请问如何解决?
//服务端
procedure TFKServer.sbcz(Bh: integer;
const Rq, Sj, Rq1, Sj1: WideString;
Sl1, Sl2, Sl3, Sl4: integer);
begin
with StoredProcdo
begin
//UnPrepared;
StoredProc.ProcedureName := 'sbcz';
StoredProc.Prepared;
StoredProc.Parameters.ParamByName('@Bh').value := Bh;
StoredProc.Parameters.ParamByName('@Rq').value := Rq;
StoredProc.Parameters.ParamByName('@Sj').Value := Sj;
StoredProc.Parameters.ParamByName('@Rq1').Value := Rq1;
StoredProc.Parameters.ParamByName('@Sj1').Value := Sj1;
StoredProc.Parameters.ParamByName('@Sl1').Value := Sl1;
StoredProc.Parameters.ParamByName('@Sl2').Value := Sl2;
StoredProc.Parameters.ParamByName('@Sl3').Value := Sl3;
StoredProc.Parameters.ParamByName('@Sl4').Value := Sl4;
StoredProc.ExecProc;
end;
客户端
frmdata.SocketConn.AppServer.sbcz(bnbh,qsrq,qssj,bnrq,bnsj,strtoint(sl1),strtoint(sl2),strtoint(sl3),strtoint(sl4));
存储结构
CREATE PROCEDURE sbcz @Bh integer,@Rq Datetime,@Sj DateTime,
@Rq1 DateTime,@Sj1 DateTime,@Sl1 integer,@Sl2 integer,@Sl3 integer,
@Sl4 integer AS
insert into ypjyb(Ypbh,Jybz,Jycs,Jysl,Jyje,Rq,Sj,Bh,Bj,Rq1,Sj1,Flag)
select kczxxb.Ypbh,kczxxb.Jybz,count(Cs) as Jycs,sum(Cz) as Jysl,sum(Cz*kczxxb.Sdj) as Jyje,
@Rq as Rq,@Sj as Sj,@Bh as Bh,0 as Bj,@Rq1 as Rq1,@Sj1 as Sj1,0
from kczxxb
where kczxxb.Bh=@Bh
group by Ypbh,Jybz
insert into ypjyb(Ypbh,Jybz,Jycs,Jysl,Jyje,Rq,Sj,Bh,Bj,Rq1,Sj1,Flag)
Values ('NPBF',-101,1,@Sl1,@Sl1,@Rq,@Sj,@Bh,0,@Rq1,@Sj1,0)
insert into ypjyb(Ypbh,Jybz,Jycs,Jysl,Jyje,Rq,Sj,Bh,Bj,Rq1,Sj1,Flag)
Values ('NPBF',-102,1,@Sl2,@Sl2,@Rq,@Sj,@Bh,0,@Rq1,@Sj1,0)
insert into ypjyb(Ypbh,Jybz,Jycs,Jysl,Jyje,Rq,Sj,Bh,Bj,Rq1,Sj1,Flag)
Values ('NPBF',-106,1,@Sl3,@Sl3,@Rq,@Sj,@Bh,0,@Rq1,@Sj1,0)
insert into ypjyb(Ypbh,Jybz,Jycs,Jysl,Jyje,Rq,Sj,Bh,Bj,Rq1,Sj1,Flag)
Values ('NPBF',-103,1,@Sl4,@Sl4,@Rq,@Sj,@Bh,0,@Rq1,@Sj1,0)
GO
//服务端
procedure TFKServer.sbcz(Bh: integer;
const Rq, Sj, Rq1, Sj1: WideString;
Sl1, Sl2, Sl3, Sl4: integer);
begin
with StoredProcdo
begin
//UnPrepared;
StoredProc.ProcedureName := 'sbcz';
StoredProc.Prepared;
StoredProc.Parameters.ParamByName('@Bh').value := Bh;
StoredProc.Parameters.ParamByName('@Rq').value := Rq;
StoredProc.Parameters.ParamByName('@Sj').Value := Sj;
StoredProc.Parameters.ParamByName('@Rq1').Value := Rq1;
StoredProc.Parameters.ParamByName('@Sj1').Value := Sj1;
StoredProc.Parameters.ParamByName('@Sl1').Value := Sl1;
StoredProc.Parameters.ParamByName('@Sl2').Value := Sl2;
StoredProc.Parameters.ParamByName('@Sl3').Value := Sl3;
StoredProc.Parameters.ParamByName('@Sl4').Value := Sl4;
StoredProc.ExecProc;
end;
客户端
frmdata.SocketConn.AppServer.sbcz(bnbh,qsrq,qssj,bnrq,bnsj,strtoint(sl1),strtoint(sl2),strtoint(sl3),strtoint(sl4));
存储结构
CREATE PROCEDURE sbcz @Bh integer,@Rq Datetime,@Sj DateTime,
@Rq1 DateTime,@Sj1 DateTime,@Sl1 integer,@Sl2 integer,@Sl3 integer,
@Sl4 integer AS
insert into ypjyb(Ypbh,Jybz,Jycs,Jysl,Jyje,Rq,Sj,Bh,Bj,Rq1,Sj1,Flag)
select kczxxb.Ypbh,kczxxb.Jybz,count(Cs) as Jycs,sum(Cz) as Jysl,sum(Cz*kczxxb.Sdj) as Jyje,
@Rq as Rq,@Sj as Sj,@Bh as Bh,0 as Bj,@Rq1 as Rq1,@Sj1 as Sj1,0
from kczxxb
where kczxxb.Bh=@Bh
group by Ypbh,Jybz
insert into ypjyb(Ypbh,Jybz,Jycs,Jysl,Jyje,Rq,Sj,Bh,Bj,Rq1,Sj1,Flag)
Values ('NPBF',-101,1,@Sl1,@Sl1,@Rq,@Sj,@Bh,0,@Rq1,@Sj1,0)
insert into ypjyb(Ypbh,Jybz,Jycs,Jysl,Jyje,Rq,Sj,Bh,Bj,Rq1,Sj1,Flag)
Values ('NPBF',-102,1,@Sl2,@Sl2,@Rq,@Sj,@Bh,0,@Rq1,@Sj1,0)
insert into ypjyb(Ypbh,Jybz,Jycs,Jysl,Jyje,Rq,Sj,Bh,Bj,Rq1,Sj1,Flag)
Values ('NPBF',-106,1,@Sl3,@Sl3,@Rq,@Sj,@Bh,0,@Rq1,@Sj1,0)
insert into ypjyb(Ypbh,Jybz,Jycs,Jysl,Jyje,Rq,Sj,Bh,Bj,Rq1,Sj1,Flag)
Values ('NPBF',-103,1,@Sl4,@Sl4,@Rq,@Sj,@Bh,0,@Rq1,@Sj1,0)
GO