L
lingmao3
Unregistered / Unconfirmed
GUEST, unregistred user!
我数据库用的是局域网sqlserver,我将这段代码放在oncreate,onshow,也是五秒,<br>求高人指点:<br>我还放了一个dbgrid和adoquery2相连.<br><br>procedure Tformxjuser.FormActivate(Sender: TObject);<br> var vvi:integer; IniFile : TIniFile;<br>begin<br> TabSheet1.Enabled:=false;<br> BitBtn12.Enabled:=true;<br> BitBtn13.Enabled:=true;<br> BitBtn14.Enabled:=true;<br> BitBtn3.Enabled:=true;<br> BitBtn2.Visible:=false;<br> BitBtn1.Visible:=false;<br> BitBtn15.Visible:=false;<br> CheckBox2.checked:=true;//列表选项<br> CheckBox3.checked:=false;//个性化设置<br> Panel1.Visible:=true;//列表选项<br> Panel4.Visible:=false;//个性化设置<br> paneltb.Visible:=false; //自动填表<br> formini;<br> adoquery2.Close;<br> adoquery2.SQL.Clear;<br> adoquery2.SQL.add('select * from t_xjuser where '+trim(editwhere.text));<br> //adoquery1.Close;<br> //adoquery1.SQL.Clear;<br> //adoquery1.SQL.add('select * from t_xjuser where '+trim(editwhere.text));<br> //adoquery2.active:=true;<br> //adoquery1.active:=true;<br> if trim(editwheretemp.text)<>'' then {被其它窗口关联}<br> begin<br> adoquery2.Close;<br> adoquery2.SQL.Clear;<br> adoquery2.SQL.add('select * from t_xjuser where '+trim(editwhere.text)+trim(editwheretemp.text));<br> end; {被其它窗口关联}<br> try {//2}<br> adoquery2.Open;<br> Except<br> ShowMessage('查询出错,请与管理员联系!');<br> Exit;<br> end; {//2 }<br> if adoquery2.RecordCount<1 then showmessage('没有查询记录,请点击“查询”按钮再进行查询');<br><br> for vvi:=0 to dbgrid1.Columns.Count-1 do//多字段排序<br> begin //1<br> ComboBoxpx1.items.add(dbgrid1.Columns[vvi].fieldname);<br> ComboBoxpx3.items.add(dbgrid1.Columns[vvi].fieldname);<br> ComboBoxpx5.items.add(dbgrid1.Columns[vvi].fieldname);<br> end; //1 多字段排序<br> adoquery2Open;//查询更新后的操作。<br><br> if fileexists('self/用户管理-列表栏头.ini') then<br> begin //2<br> iniFile := TIniFile.Create('self/用户管理-列表栏头.ini');<br> for vvi:=0 to dbgrid1.Columns.Count-1 do<br> begin //1<br> dbgrid1.Columns[vvi].width:=strtoint(IniFile.ReadString('列表', 'width'+inttostr(vvi)+'', ''));<br> dbgrid1.Columns[vvi].fieldname:=IniFile.ReadString('列表', 'fieldname'+inttostr(vvi)+'', '');<br> dbgrid1.Columns[vvi].title.Caption:=IniFile.ReadString('列表', 'caption'+inttostr(vvi)+'', '');<br> end; //1<br> IniFile.Free;<br> end;//2<br> BitBtndgsxClick(Sender);//定格刷新<br>end; //fromactive结束