存储过程如何返回结果集(在dbgrid中显示)??(50分)

J

jacklee

Unregistered / Unconfirmed
GUEST, unregistred user!
CREATE PROCEDURE cx @tn char (13) AS select * from hjkcb where tm=@tn

在delphi中已做了相应连接dbgrid->datasource1->storceproc

sp1.Active:=false;
//sp1.StoredProcName:='cx';
sp1.ParamByName('@tn').asstring:=edit1.text;
sp1.ExecProc;

如何显示返回的结果集呢??
 
有问题吗?
 
sp1.Active:=false;
//sp1.StoredProcName:='cx';
sp1.ParamByName('@tn').asstring:=edit1.text;
sp1.active:=true;

 
这样就好了,我也是昨天解决的,
sp1.Active:=false;
//sp1.StoredProcName:='cx';
sp1.ParamByName('@tn').asstring:=edit1.text;
sp1.open;

因为,如果要存储过程返回数据集的话就要用,sp1.open
是不返回数据集,只要执行你的存储过程就用,sp1.ExecProc;
 
我也凑个热闹,用open是可以的,不过不能关闭,否则不显示
那么请问:长时间的打开一个存储过程会不会引起数据库服务器出现问题(如速度变慢等)
因为我知道如果用execproc执行存储过程过程中如果有中断,数据库服务器会变得非常慢的.
 
感谢zccar和w12345678
ok,搞定.散分了.大家接着!!!啊哈哈哈哈
 
顶部