据一个简单点的例子:
1.先建下面的存储过程:
Create Procedure aa
as
declare @i int,@j int, @k int
if exists(select * from temptable)
begin
delete from temptable
end
declare cur cursor for select aaa,bbb from ccc where somthing
open cur
fetch cur into @i,@j
while (@@fetch_status=0)
begin
[do some calculate processing]
select @k=@i[calculate]@j
insert into temptable(col1,col2,col3)
value (@i,@j,@k)
fetch cur into @i,@j
end
close cur
deallocate cur
2.在Delphi中,设置 storedproc1:TStoredProc,使其参数指向存储过程 aa
3.在Delphi中建立Query1:TQuery ,其中区query1.SQL为select * from tmptable
4.按需要画好QuickReport,并设置好query1的各字段显示
5.具体处理代码如下:
begin
storedproc1.execproc;
query1.open;
quickrep1.print;//or quickrep1.preview;
storedproc1.close;
query1.close;
end;
如果还不清楚,请直接给我的e-mail来信,
我将我项目中的相关的代码寄给你,我要下线了。
我的e-mail:roger2yang@163.com