我的数据库文件有6条记录,代码如下:
m_pRecordset.CreateInstance(__uuidof(Recordset));
try
{
m_pRecordset->Open("SELECT * FROM taxitem",
m_pConnection.GetInterfacePtr(),
adOpenDynamic,
adLockOptimistic,
adCmdText);
}
catch(_com_error *e)
{
AfxMessageBox(e->ErrorMessage());
}_variant_t var;
try
{
if(!m_pRecordset->BOF)
m_pRecordset->MoveFirst(); while (!m_pRecordset->adoEOF)
{
var = m_pRecordset->GetCollect("pro_cname");
if(var.vt != VT_NULL)
ItexName = (LPCSTR)_bstr_t(var);
m_ItemName.AddString(ItexName);
m_pRecordset->MoveNext();
}
}
catch(_com_error *e)
{
AfxMessageBox(e->ErrorMessage());
}好像那个m_pRecordset->MoveNext()不起作用
m_pRecordset.CreateInstance(__uuidof(Recordset));
try
{
m_pRecordset->Open("SELECT * FROM taxitem",
m_pConnection.GetInterfacePtr(),
adOpenDynamic,
adLockOptimistic,
adCmdText);
}
catch(_com_error *e)
{
AfxMessageBox(e->ErrorMessage());
}_variant_t var;
try
{
if(!m_pRecordset->BOF)
m_pRecordset->MoveFirst(); while (!m_pRecordset->adoEOF)
{
var = m_pRecordset->GetCollect("pro_cname");
if(var.vt != VT_NULL)
ItexName = (LPCSTR)_bstr_t(var);
m_ItemName.AddString(ItexName);
m_pRecordset->MoveNext();
}
}
catch(_com_error *e)
{
AfxMessageBox(e->ErrorMessage());
}好像那个m_pRecordset->MoveNext()不起作用
解决方案 »
- 终于有分了,重新发贴提问dll的问题,大家都来帮忙看看,请伸出援助之手,我被折磨毁了
- 汉字编码问题:如何从内码(char * 类型)转为 unicode码?
- 谁推荐几款vs2005的插件
- clistctlr选中一个item?? 通过其他程序。
- 如何利用ftp作中继,连接局域网和Internet?
- 如何设计这样的菜单???
- 简单问题,希望大家来帮助!
- 新手求救1->头都大了
- 高分请教!我的程序运行后,打开菜单,可是菜单是虚的,请问为什么?(不是编辑相关的,自己添加的)
- 更新:如何将数值型变量放入char h[]中?(给出我的最高分!!)
- EVC(UNICODE)里面用哪个替换 atoi ? 有没有编写好的宏可用?
- ©速度揭帖©怎样使程序在屏幕中心呀?
==如果MoveNext不管用,那么你这个while应该是死循环了,那么实际上是不是呢?
你不妨调试一下,看看每次取出的内容是一样的么?