I
itluo
Unregistered / Unconfirmed
GUEST, unregistred user!
ADO 连接 SQLSERVER
客户端 TclientDataSet
执行 COMMANDTEXT := 'execute xy_checkXinyongE @CBH="某编号"'时
SERVER 端提示:"在异步运行时,操作不能被执行!"
其中 xy_checkXinyongE 为 sqlserver 的过程,如下:
create procedure xy_checkXinyongE
@cbh varchar(8)
as
set nocount on
declare @f_xye numeric(12,2)
select @f_xye=fxye from pub_client
where cbh=@cbh
if @f_xye<=0 begin
select iid,cbh,cmc,fxye,csh,ctel,b_open,cbank,
cbank_zh,i_xyq,f_qc,f_jf,f_df,cpost_dz,c_ywy
from pub_client
where cbh=@cbh
return
end
create table #temp1(
f_qc numeric(12,2) default 0,
f_jf numeric(12,2) default 0,
f_df numeric(12,2) default 0,
f_xye numeric(12,2) default 0,
b_open bit default 0
)
insert #temp1
values(0,0,0,0,0)
create table #temp2(
i_dl int,
f_jf numeric(12,2)
)
insert #temp2(i_dl,f_jf)
select m.i_dl,sum(i.f_sl * i.f_xsdj)
from T_guand_master_zb m
inner join T_guand_item_zb i on(m.i_key=i.i_key)
where (year(m.d_date_lr)=year(getdate())) and
(m.b_trash<>1) and (m.i_dl<0) and
(m.i_key_client=(select iid from pub_client where cbh=@cbh))
group by m.i_dl
update #temp2
set f_jf= -f_jf
where i_dl<>-1
update #temp1
set f_jf =(select sum(f_jf) from #temp2)
update #temp1
set f_df= (select sum(f_shoukuan) from T_money_shoukuan
where (b_zuofei<>1)and(i_key_client=
(select iid from pub_client where cbh=@cbh)))
if year(getdate())=2003
update #temp1
set f_qc=(select f_je from T_guand_qc_yingshou
where i_key_client=(select iid from pub_client where cbh=@cbh) and
year(d_date_qr)=2003 )
else
update #temp1
set f_qc=(select (f_qc+f_jf-f_df-f_dfz) from T_guand_money_XSjz
where (year(d_date)=year(getdate())-1) and month(d_date)=12 and
(i_key_client=(select iid from pub_client where cbh=@cbh)))
/*update #temp1
set f_xye = k.fxye,b_open=k.b_open
from #temp1 t, pub_client k
where k.cbh=@cbh*/
select t.f_qc,t.f_jf,t.f_df,k.iid,k.cbh,k.cmc,k.fxye,k.csh,k.ctel,k.b_open,
k.cbank,k.cbank_zh,k.i_xyq,k.cpost_dz,k.c_ywy
from #temp1 t,pub_client k
where k.cbh=@cbh
/*iid,cbh,cmc,fxye,csh,ctel,b_open,'+
'cbank,cbank_zh,i_xyq,f_qc,f_jf,f_df,'+
'cpost_dz,c_ywy*/
drop table #temp1
drop table #temp2
解决者高分送上!
客户端 TclientDataSet
执行 COMMANDTEXT := 'execute xy_checkXinyongE @CBH="某编号"'时
SERVER 端提示:"在异步运行时,操作不能被执行!"
其中 xy_checkXinyongE 为 sqlserver 的过程,如下:
create procedure xy_checkXinyongE
@cbh varchar(8)
as
set nocount on
declare @f_xye numeric(12,2)
select @f_xye=fxye from pub_client
where cbh=@cbh
if @f_xye<=0 begin
select iid,cbh,cmc,fxye,csh,ctel,b_open,cbank,
cbank_zh,i_xyq,f_qc,f_jf,f_df,cpost_dz,c_ywy
from pub_client
where cbh=@cbh
return
end
create table #temp1(
f_qc numeric(12,2) default 0,
f_jf numeric(12,2) default 0,
f_df numeric(12,2) default 0,
f_xye numeric(12,2) default 0,
b_open bit default 0
)
insert #temp1
values(0,0,0,0,0)
create table #temp2(
i_dl int,
f_jf numeric(12,2)
)
insert #temp2(i_dl,f_jf)
select m.i_dl,sum(i.f_sl * i.f_xsdj)
from T_guand_master_zb m
inner join T_guand_item_zb i on(m.i_key=i.i_key)
where (year(m.d_date_lr)=year(getdate())) and
(m.b_trash<>1) and (m.i_dl<0) and
(m.i_key_client=(select iid from pub_client where cbh=@cbh))
group by m.i_dl
update #temp2
set f_jf= -f_jf
where i_dl<>-1
update #temp1
set f_jf =(select sum(f_jf) from #temp2)
update #temp1
set f_df= (select sum(f_shoukuan) from T_money_shoukuan
where (b_zuofei<>1)and(i_key_client=
(select iid from pub_client where cbh=@cbh)))
if year(getdate())=2003
update #temp1
set f_qc=(select f_je from T_guand_qc_yingshou
where i_key_client=(select iid from pub_client where cbh=@cbh) and
year(d_date_qr)=2003 )
else
update #temp1
set f_qc=(select (f_qc+f_jf-f_df-f_dfz) from T_guand_money_XSjz
where (year(d_date)=year(getdate())-1) and month(d_date)=12 and
(i_key_client=(select iid from pub_client where cbh=@cbh)))
/*update #temp1
set f_xye = k.fxye,b_open=k.b_open
from #temp1 t, pub_client k
where k.cbh=@cbh*/
select t.f_qc,t.f_jf,t.f_df,k.iid,k.cbh,k.cmc,k.fxye,k.csh,k.ctel,k.b_open,
k.cbank,k.cbank_zh,k.i_xyq,k.cpost_dz,k.c_ywy
from #temp1 t,pub_client k
where k.cbh=@cbh
/*iid,cbh,cmc,fxye,csh,ctel,b_open,'+
'cbank,cbank_zh,i_xyq,f_qc,f_jf,f_df,'+
'cpost_dz,c_ywy*/
drop table #temp1
drop table #temp2
解决者高分送上!