为什么Ado比BDE 慢许多
TQuery和TADOQuery查询语句一模一样。但在显示数据时后者慢好多,有什么办法?而且发现用TQuery组件时DBGrid刷新快,一直有垂直滚动条,而用TADOQuery时刷新慢,且垂直滚动条有时有,有时没(视记录多少而定),还有就是DBGrid表格头也明显跟着刷新。
贴出代码:TADOQuery的:
char temp[15];
Query1->Close();
Query1->Parameters->ParamByName("sDate")->Value=Now()-20;
Query1->Parameters->ParamByName("lDate")->Value=Now()+1;
Query1->Parameters->ParamByName("deporcom")->Value="%";
if(TV->SelectionCount==0)
Query1->Parameters->ParamByName("GroupID")->Value="";
else
{
sprintf(temp,"%010d",(int)TV->Selected->Data);//TV为TTreeView树控件
Query1->Parameters->ParamByName("GroupID")->Value=temp;
}
Query1->Open();
////////////////////////////////////////////
TQuery的代码(与上几乎一模一样,就是多Prepare()
char temp[15];
Query1->Close();
Query1->ParamByName("sDate")->AsDateTime=FDTPicker->DateTime;
Query1->ParamByName("lDate")->AsDateTime=TDTPicker->DateTime;
Query1->ParamByName("deporcom")->AsString="%"+DepCBox->Text+"%";
if(TV->SelectionCount==0)
Query1->ParamByName("GroupID")->AsString="";
else
{
sprintf(temp,"%010d",(int)TV->Selected->Data);
Query1->ParamByName("GroupID")->AsString=temp;
}
Query1->Prepare();
Query1->Open();