ADOQuery1->RecordCount为什么返回不了记录行数?
前提:C++ builder + access数据库
如题,在BCB中,RecordCount为什么总是0?
直接从查询分析器中将查询语句写进去结果是有多条数据的。目的是要取回记录的行数。
AnsiString tmsql;
ADOQuery1->ConnectionString = conselacess;
tmsql = "SELECT * FROM notes130228 where tetmaddr like '*6926*'";
try
{
ADOQuery1->Close();
ADOQuery1->SQL->Clear();
ADOQuery1->SQL->Add(tmsql);
ADOQuery1->Open();
int selcount = ADOQuery1->RecordCount;
}
catch(Exception &e)
{
ShowMessage("查询数据异常");
}
tmsql = "SELECT count(*) as acnum FROM notes130228 where tetmaddr like '*6926*'";