由于数据库过于庞大,调入数据需要很久--最慢也需要35秒+~这简直让人无法忍受。。我了解到可以进行异步处理,但是,我将ADOConnection的ConnectOptions 属性置为coAsyncConnect测试:不行!后来将ADOQuery替换为ADODateSet,将ADODateSet的ExectcuetOptions的eoAsyncFetchNonBlocking置为true测试:不行!我也了解过可以用线程处理,可是小弟几乎对线程一窍不通希望达人们指点,,谢谢了!
解决方案 »
- dbgrideh如何在里面输入数据?
- 求购:Delphi 5.X分布式多层应用系统篇/电子商务篇
- 字符串这去掉一段用什么函数
- 谁能提供软件注册的参考代码或源代码软件
- *****辞职了,散点分给大家意思意思******
- ado的小问题,高手们进来帮帮忙,谢谢,【在线】
- 怎样将采样时间插入到数据库中?
- 我要自杀了!谁来救我!如何将从串口读出的ASCii码流读到RcihEdit中,同时对ASCii码流进行分析,取特定字符串?
- pls:插件dll中的Frame dock到主程序中的panel中出现的问题
- 请问怎样启动ie浏览一个网页,并且打开新的ie窗口,不使用当前ie窗口?
- 具備挑戰性的問題,喜歡挑戰的朋友進
- 有人了解郑州的美萍软件吗?进来说说情况
后来将ADOQuery替换为ADODateSet,将ADODateSet的ExectcuetOptions的eoAsyncFetchNonBlocking置为true这应该可以
你可以试一下动态设置,
在OPEN前
用ADOdataset.active:=false;
然后EADOdataset.xectcuetOptions:=[eoAsyncFetchNonBlocking];
然后再ADOdataset.active:=true
然后再OPEN
FMonth=FormChoseMonth->ComboBox->Text; //FMonth是个全局变量,用来存放前面一个窗体选择的时间
Month(); //一个自定义函数,目的用来判断用户是查看几月分的资料
suiForm1->Caption=FMonth+"消费次TOP100排行榜"; //窗体标题显示
//建立一个视图来存放数据。窗口关闭时删除!
ISql.printf("create view dba.v_AAAA as select t_ProtocolCorp.ProtocolCorpNo,ProtocolCorpName+'-【协议单位】' as ProtocolCorpName,phone,count(a1.totalmoney),sum(a1.totalmoney),re \
from (select billno,guestno,businessdate,totalmoney \
from t_bill_his \
where businessdate>='%s' and businessdate<='%s') as a1,t_ProtocolCorp \
where a1.guestno=t_ProtocolCorp.ProtocolCorpNo \
group by t_ProtocolCorp.ProtocolCorpNo,phone,re,ProtocolCorpName \
union \
select t_card.cardno,membername+'-【会员】' as membername,t_member.phone,count(a2.totalmoney),sum(a2.totalmoney),t_member.re \
from (select billno,guestno,businessdate,totalmoney \
from t_bill_his \
where businessdate>='%s' and businessdate<='%s') as a2,t_card,t_member \
where a2.guestno=t_card.cardno and t_card.memberno=t_member.memberno \
group by t_card.cardno,t_member.phone,re,t_member.membername \
union \
select t_Customer.Customerno,Customername+'-【散客】' as Customername,phone,count(a3.totalmoney),sum(a3.totalmoney),re \
from (select billno,guestno,businessdate,totalmoney \
from t_bill_his \
where businessdate>='%s' and businessdate<='%s') as a3,t_Customer \
where a3.guestno=t_Customer.Customerno \
group by t_Customer.Customerno,t_Customer.Customername,phone,re",FStatDate,FEndDate,FStatDate,FEndDate,FStatDate,FEndDate);//FStatDate表示初始日期,FEndDate表示结束日期
ADOTemp->Active=false;
ADOTemp->SQL->Clear();
ADOTemp->SQL->Add(ISql);
ADOTemp->ExecSQL(); //执行SQL,建立视图
ISql="select top 100 * from v_AAAA order by expression desc"; //查找出该视图TOP100数据
ADODataSet->Active=false;
ADODataSet->CommandText=ISql;
ADODataSet->ExecuteOptions.operator >>(eoAsyncFetchNonBlocking);
ADODataSet->Active=true;
ADODataSet->Open(); 整段代码如上了, ,但是依然不能异步痛苦ing~~
用线程也不难,自己看看书吧