紧急的挠头问题。。。在线。。。。
代码如下:
void __fastcall TtfDownClock::FormCreate(TObject *Sender)
{
AnsiString asSQL,asStType,asTemp;
int iCGaugeMark;
asSQL = "select rvalue from sys_codelist where codetypeid = 'sttype'" ;
DataModule2->ADO_Select1->Close();
DataModule2->ADO_Select1->SQL->Clear();
DataModule2->ADO_Select1->SQL->Add(asSQL);
DataModule2->ADO_Select1->Open();
DataModule2->ADO_Select1->First();
while (!DataModule2->ADO_Select1->Eof)
{
asStType = DataModule2->ADO_Select1->FieldByName("rvalue")->AsString;
ComboBox1->Items->Add(asStType);
DataModule2->ADO_Select1->Next();
}
}
//---------------------------------------------------------
void __fastcall TtfDownClock::ComboBox1Change(TObject *Sender)
{
AnsiString asSQL,asStType;
int iCGaugeMark;
asSQL = "select sys_stinfo,st_cname from sys_stinfo,sys_codelist where ( sys_stinfo.st_type = convert(varchar,sys_codelist.sid) ) and ( sys_codelist.codetypeid = 'sttype' ) and ( sys_codelist.rvalue = '" + ComboBox1->Text + "' )";
tfMain->DisplayCGauge("");
DataModule2->ADO_Select1->Close();
DataModule2->ADO_Select1->SQL->Clear();
DataModule2->ADO_Select1->SQL->Add(asSQL);
DataModule2->ADO_Select1->Open();
ComboBox2->Items->Clear();
DataModule2->ADO_Select1->First();
while (!DataModule2->ADO_Select1->Eof)
{
asStType = DataModule2->ADO_Select1->FieldByName("st_cname")->AsString;
ComboBox2->Items->Add(asStType);
DataModule2->ADO_Select1->Next();
}
}
问题出现的很奇怪,上一次调试的时候还好好的,过了一个晚上,就出了问题。问题是:在ComboBox1中选择内容的时候,就弹出了错误,either bof or eof is true,or the current record has been deleted. Requested operation requires a current record。补丁我也打了(BCB 5),也重新启动了,还重新编译了,可还是有问题。而且就是在ComboBox1Change()中的DataModule2->ADO_Select1->Close(); 出的问题,那为什么在FormCreate()中就没有问题呢??
请高手帮忙解决,着急呀。。。。。。