代码出错qry1:cannot perform this operation on a closed dataset
String sql; sql = "select * from 出勤表 "; sql += "where 年 = '"+cbb1->Text+"' and 月 = '"+cbb2->Text+"' "; sql += " and 姓名 = '"+Name+"' "; qry1->Close(); qry1->SQL ->Clear(); qry1->SQL ->Text = sql; qry1->Open(); qry1->First(); while(!qry1->Eof ) { try { for(int i=0;i<25;i++) { if(qry1->FieldByName("日")->AsString == cbb[i]->Caption) { if( qry1->FieldByName("出勤")->AsString == "Yes") cbb[i]->Checked = true; else cbb[i]->Checked = false; break; } } qry1->Next();//出错提示“qry1:cannot perform this operation on a closed dataset” } catch(...) { }