1,178
社区成员
发帖
与我相关
我的任务
分享
if (!ADOQuery1->Eof)
{
Edit2->Text=ADOQuery1->FieldByName("date")->AsDateTime;
Edit3->Text=ADOQuery1->FieldByName("time")->AsDateTime;
Edit4->Text=ADOQuery1->FieldByName("NT")->AsString;
Edit5->Text=ADOQuery1->FieldByName("WT")->AsString;
Edit6->Text=ADOQuery1->FieldByName("GT")->AsString;
int q=ADOQuery1->RecordCount;
if(ADOQuery1->FindFirst()) //查找结果集中的第一条记录
{
StringGrid1-> Align=alClient;
StringGrid1->RowCount=q; //设置StringGrid1的总行数
StringGrid1-> ColCount=8;
StringGrid1-> Cells[1][0]= "姓名 ";
StringGrid1-> Cells[2][0]= "日期 ";
StringGrid1-> Cells[3][0]= "时间 ";
StringGrid1-> Cells[4][0]= "G.T. ";
StringGrid1-> Cells[5][0]= "W.T. ";
StringGrid1-> Cells[6][0]= "G.T. ";
int m=0;
while(m<q)
{
if(ADOQuery1->FindNext()) //查找结果集中的下一条记录,是不是这里有问题?
{
StringGrid1-> Cells[1][m+1]= ADOQuery1->FieldByName("peifang")->AsString;
StringGrid1-> Cells[2][m+1]= ADOQuery1->FieldByName("date")->AsDateTime;
StringGrid1-> Cells[3][m+1]= ADOQuery1->FieldByName("time")->AsDateTime;
StringGrid1-> Cells[4][m+1]= ADOQuery1->FieldByName("NT")->AsString;
StringGrid1-> Cells[5][m+1]= ADOQuery1->FieldByName("WT")->AsString;
StringGrid1-> Cells[6][m+1]= ADOQuery1->FieldByName("GT")->AsString;
}
m++;
}
}