由于数据库过于庞大,调入数据需要很久--最慢也需要35秒+~这简直让人无法忍受。。我了解到可以进行异步处理,但是,我将ADOConnection的ConnectOptions 属性置为coAsyncConnect测试:不行!后来将ADOQuery替换为ADODateSet,将ADODateSet的ExectcuetOptions的eoAsyncFetchNonBlocking置为true测试:不行!我也了解过可以用线程处理,可是小弟几乎对线程一窍不通希望达人们指点,,谢谢了!

解决方案 »

  1.   


    后来将ADOQuery替换为ADODateSet,将ADODateSet的ExectcuetOptions的eoAsyncFetchNonBlocking置为true这应该可以
    你可以试一下动态设置,
    在OPEN前
    用ADOdataset.active:=false;
    然后EADOdataset.xectcuetOptions:=[eoAsyncFetchNonBlocking];
    然后再ADOdataset.active:=true
    然后再OPEN
      

  2.   

    我把弹出那个统计窗体的FROMSHOW事件全部代码给你看吧~~结果还是不行郁闷S~~   AnsiString ISql;
       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~~
      

  3.   

    你贴到BCB版啊
    用线程也不难,自己看看书吧