procedure TForm4.Query1AfterOpen(DataSet: TDataSet);
begin
if DispRecordCount then
Self.StatusBar1.Panels[0].Text:='记录个数: '+
IntToStr(Self.Query1.RecordCount);
end;就这段出了问题,原来的时候你也见过,是能计数的。后来我把这段代码放到了主窗口FORM1的弹出式窗口2上,就是在主窗口上按按钮就会弹出的窗口。结果查询是正常的,就计算记录的功能出了问题。StatusBar1.Panels[0]上啥也没有了。
begin
if DispRecordCount then
Self.StatusBar1.Panels[0].Text:='记录个数: '+
IntToStr(Self.Query1.RecordCount);
end;就这段出了问题,原来的时候你也见过,是能计数的。后来我把这段代码放到了主窗口FORM1的弹出式窗口2上,就是在主窗口上按按钮就会弹出的窗口。结果查询是正常的,就计算记录的功能出了问题。StatusBar1.Panels[0]上啥也没有了。
procedure TForm4.FormShow(Sender: TObject);
var
iCount:Integer;
strName:String;
begin
DispRecordCount:=false;
ComboBox2.Items.Clear;
Query1.Open;
for iCount:=0 to Query1.FieldCount -1 do
begin
strName:=self.Query1.FieldList[iCount].FieldName;
ComboBox2.Items.Add(strName);
end;
Query1.Close;
ComboBox2.ItemIndex:=0;
DispRecordCount:=true;
DataSource1.DataSet:= QUery1;
end;procedure TForm4.Query1AfterOpen(DataSet: TDataSet);
begin
if DispRecordCount then
Self.StatusBar1.Panels[0].Text:='记录个数: '+
IntToStr(Self.Query1.RecordCount);
end;AfterOpen有个waring提醒,很恶心改成我给你的函数。
行了。
我不说让你...