V
victor9871
Unregistered / Unconfirmed
GUEST, unregistred user!
一个access 数据库 一个表有40万条数据 如何实现查询速度快点 这是本人的代码procedure TFrm_Custom.Btn_S_CustClick(Sender: TObject);var Str:String; i,CustCode:integer; TempSQL,CodeIn,S_Field,Temp:String;begin if Trim(Combo_type.Text)='' then begin MessageBox(self.Handle,'请选择一种查询条件进行查询!','提示',MB_OK or MB_ICONInformation); Exit; end; Screen.Cursor:=crHourglass; Btn_S_Cust.Enabled:=False; Str:='%'+Edit_Key.Text+'%'; with Frm_Data.Qry_Str do begin Close; SQL.Clear; SQL.Add('select * from T_FieldShow where tablename=''Custom'' and Name='''+Combo_type.Text+''''); Open; S_Field:=FieldByName('Field').AsString; end; TempSQL:='Select * from Custom where '+S_Field+' like '''+Str+''''; With Frm_Data.Qry_Cust do begin Close; SQL.Clear; SQL.Add(TempSQL); Open; end; Frm_Main.AddToGridEh(Grid_Cust,Frm_Data.Qry_Cust,'Custom'); frm_main.StatusBar1.Panels[1].Text:='当前共有 '+IntToStr(Frm_data.Qry_Cust.RecordCount)+' 条客户记录'; Btn_S_Cust.Enabled:=True; Grid_Cust.Columns[0].Footer.valuetype:=fvtstatictext; //DBGridEh 最后一排显示总计信息 Grid_Cust.Columns[0].Footer.value:='总计'; Grid_Cust.Columns[1].Footer.valuetype:=fvtcount; Screen.Cursor:=crDefault;end;