当前位置:编程学习 > C#/ASP.NET >>

请教一个ADO+ACCESS数据库访问方面的问题

VS2010+ACCESS2003

_ConnectionPtr m_pConnect;
_RecordsetPtr m_pRecrodset;

m_pRecrodset = m_pConnection->Execute(L"select * from singer",&RecrodsAffected,adCmdText);
此时的pRecrodset是不是保存着所有查到数据呢?如果不是,如何取得m_pConnection->Execute(L"select * from singer",&RecrodsAffected,adCmdText);
执行后数据呢? --------------------编程问答-------------------- m_pRecrodset = m_pCommand->Execute(&vNULL,&vNULL,adCmdText); --------------------编程问答--------------------  m_pCommand->Execute(&vNULL,&vNULL,adCmdText); 
梁用Command对象来执行SQL命令时,如何得到数据呢? --------------------编程问答-------------------- m_pRecrodset = m_pConnection->Execute(L"select * from singer",&RecrodsAffected,adCmdText);

我知道了,此时记录集中已经有数据了。
使用
while(!m_pRecrodset->adoEOF)
{

_str = m_pRecrodset->GetCollect("Name");
m_pRecrodset->MoveNext();
}
就可以依次取出记录了,只是当我想用
int i = m_pRecrodset->RecordCount;
想获得记录数量里,i 总是 -1,这是为什么呢?难道用连接对象或者命令对象然后赋值给记录集对象时不能用m_pRecrodset->RecordCount;方法获得记录的数量吗?
补充:.NET技术 ,  VC.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,