请教大家BCB使用SQL数据库的奇怪问题
dxgxk 2002-03-03 09:43:07 请看下面的代码:
void __fastcall TForm1::Button7Click(TObject *Sender)
{
AnsiString s;
s="Select count(*) As temp from h1";
Query1->Close();
Query1->SQL->Clear();
Query1->SQL->Add(s);
Query1->ExecSQL(); //这如果用Query1->Open();运行时显示错误 Table read only
Edit3->Text=Query1->FieldByName("temp")->AsString;
//Edit3->Text=Query1->Fields[0]->AsString; //如果用这句编译时出现错误
Query1->Close();
}
运行时出现错误: Query1:FIELD'temp' not found, 请问是怎么会事??