Y
yuanyoufa
Unregistered / Unconfirmed
GUEST, unregistred user!
我的存储过程是:
CREATE procedure proc_jifensc_1
( @kkhcode char(10)
)
AS
BEGIN
if exists(select * from jifensc where riqi<'2006-01-01'and kkhcode=@kkhcode)
begin
begin tran
delete jifensc where riqi<'2006-01-01' and kkhcode=@kkhcode /*删除超过六个月的记录*/
if @@error<>0
begin
rollback tran
print('数据库发生未知错误,请联系开发人员!')
return
end
else
commit tran
end
select a.kkhcode,a.kkhname,sum(b.jifen)as jifen,sum(b.jine)as jine from cardcust a,jifensc b where a.kkhcode=b.kkhcode and a.kkhcode=@kkhcode group by a.kkhcode,a.kkhname
return
end
GO
然后delphi中是这样设置的:
try
with datamodule1.chaxunjf1 do //输入存储过程查询积分
begin
close;
prepared:=false;
parameters.ParamByName('@kkhcode').Value:='0001';
prepared:=true;
execproc;
labelededit3.Text:=fieldbyname('kkhcode').AsString;
labelededit4.Text:=fieldbyname('kkhname').AsString;
labelededit5.Text:=fieldbyname('jifen').AsString;
labelededit6.Text:=fieldbyname('jine').AsString;
end;
except
MessageDlg('软件在操作数据库发生错误,请关闭重试!',mtError,[mbok],0);
end;
可是我在调试的时候老是报错:
chaxunjf1arameter '@kkhcode' not found
我感觉我写的都对呀?
CREATE procedure proc_jifensc_1
( @kkhcode char(10)
)
AS
BEGIN
if exists(select * from jifensc where riqi<'2006-01-01'and kkhcode=@kkhcode)
begin
begin tran
delete jifensc where riqi<'2006-01-01' and kkhcode=@kkhcode /*删除超过六个月的记录*/
if @@error<>0
begin
rollback tran
print('数据库发生未知错误,请联系开发人员!')
return
end
else
commit tran
end
select a.kkhcode,a.kkhname,sum(b.jifen)as jifen,sum(b.jine)as jine from cardcust a,jifensc b where a.kkhcode=b.kkhcode and a.kkhcode=@kkhcode group by a.kkhcode,a.kkhname
return
end
GO
然后delphi中是这样设置的:
try
with datamodule1.chaxunjf1 do //输入存储过程查询积分
begin
close;
prepared:=false;
parameters.ParamByName('@kkhcode').Value:='0001';
prepared:=true;
execproc;
labelededit3.Text:=fieldbyname('kkhcode').AsString;
labelededit4.Text:=fieldbyname('kkhname').AsString;
labelededit5.Text:=fieldbyname('jifen').AsString;
labelededit6.Text:=fieldbyname('jine').AsString;
end;
except
MessageDlg('软件在操作数据库发生错误,请关闭重试!',mtError,[mbok],0);
end;
可是我在调试的时候老是报错:
chaxunjf1arameter '@kkhcode' not found
我感觉我写的都对呀?