我用DBGRID显示数据,当用下箭头向下移动,对应的EDIT能同步显示,但用上箭头向上移动,edit显示滞后一条,不同步,但当前记录号是同步的,如何解决请教各位高手。
具体代码如下:
procedure Txc_wldw.dbgrid1drawcolumncell(Sender: TObject;
const Rect: TRect; DataCol: Integer; Column: TColumn;
State: TGridDrawState);
begin
edit1.text := xc.adodataset1['xh'];
edit2.text := xc.adodataset1['zjc'];
edit3.text := xc.adodataset1['wldwmc'];
edit4.text := xc.adodataset1['lxdh'];
edit5.text := xc.adodataset1['lxr'];
label6.Caption:='当前记录:第'+IntToStr(TStringGrid(DBGrid1).Row)+'条';
label7.Caption:='共有记录:'+IntToStr(xc.ADODataSet1.RecordCount)+'条';
end;
具体代码如下:
procedure Txc_wldw.dbgrid1drawcolumncell(Sender: TObject;
const Rect: TRect; DataCol: Integer; Column: TColumn;
State: TGridDrawState);
begin
edit1.text := xc.adodataset1['xh'];
edit2.text := xc.adodataset1['zjc'];
edit3.text := xc.adodataset1['wldwmc'];
edit4.text := xc.adodataset1['lxdh'];
edit5.text := xc.adodataset1['lxr'];
label6.Caption:='当前记录:第'+IntToStr(TStringGrid(DBGrid1).Row)+'条';
label7.Caption:='共有记录:'+IntToStr(xc.ADODataSet1.RecordCount)+'条';
end;
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货