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("查询数据异常");
}
这样执行完后,selcount 始终为0
如果将查询字符串写成
tmsql = "SELECT count(*) as acnum FROM notes130228 where tetmaddr like '*6926*'";
ADOQuery1->RecordCount;会返回有一条数据,但是我将acnum用
int selcount = ADOQuery1->FieldByName("acnum ")->AsInteger;取回来,结果依然是0;为什么?
...全文
相关推荐
Delphi中的ADOquery 用法
Delphi中的ADOquery 用法Delphi中的ADOquery 用法Delphi中的ADOquery 用法
ADODataSet、ADOTable、ADOQuery的属性
NULL 博文链接:https://tengguanbing.iteye.com/blog/1769320
ADOQuery使用方法
delphi+SQL数据库中ADOQuery的使用方法
Delphi adoquery处理多条SQL语句
Delphi adoquery处理多条SQL语句
ADOQuery连接数据库的查询、插入、删除、修改
ADOQuery连接数据库的查询、插入、删除、修改 右下角还有Delphi资料



