"The rowset is not bookmarkable"出错
来源:互联网 发布:二战德国和苏联知乎 编辑:程序博客网 时间:2024/05/22 03:38
用一个ADO+DATAGRID写的程序,编译正常.运行时出现"rowset is not bookmarkable",查了函数的调用和类型.都没有问题.
搜索了下.原来是游标的问题.
在ADOConn类的中GetRecordset方法中增加一句m_pRecordset->CursorLocation=adUseClient;
即:
// 执行查询
_RecordsetPtr& ADOConn::GetRecordSet(_bstr_t bstrSQL)
{
try
{
// 连接数据库,如果Connection对象为空,则重新连接数据库
if(m_pConnection==NULL)
OnInitADOConn();
// 创建记录集对象
m_pRecordset.CreateInstance(__uuidof(Recordset));
//增加这一句.
m_pRecordset->CursorLocation=adUseClient; //游标的位置出现.不加这句会出现The rowset is not //bookmarkable运行错误
// 取得表中的记录
m_pRecordset->Open(bstrSQL,m_pConnection.GetInterfacePtr(),adOpenDynamic,adLockOptimistic,adCmdText);
}
// 捕捉异常
catch(_com_error e)
{
// 显示错误信息
AfxMessageBox(e.Description());
}
// 返回记录集
return m_pRecordset;
}
调用的方法是:
BOOL CDataGridDlg::OnInitDialog()
{
CDialog::OnInitDialog();
//原代码省略
// TODO: Add extra initialization here
//************************************************************
ADOConn m_ado;
_bstr_t vSql="select * from users";
_RecordsetPtr m_pRecordset;
m_ado.OnInitADOConn();
m_pRecordset=m_ado.GetRecordSet(vSql);
m_datagrid.SetRefDataSource((LPUNKNOWN)m_pRecordset);//m_datagrid为DataGrid控件的变量.
//************************************************************
return TRUE; // return TRUE unless you set the focus to a control
}
搜索了下.原来是游标的问题.
在ADOConn类的中GetRecordset方法中增加一句m_pRecordset->CursorLocation=adUseClient;
即:
// 执行查询
_RecordsetPtr& ADOConn::GetRecordSet(_bstr_t bstrSQL)
{
try
{
// 连接数据库,如果Connection对象为空,则重新连接数据库
if(m_pConnection==NULL)
OnInitADOConn();
// 创建记录集对象
m_pRecordset.CreateInstance(__uuidof(Recordset));
//增加这一句.
m_pRecordset->CursorLocation=adUseClient; //游标的位置出现.不加这句会出现The rowset is not //bookmarkable运行错误
// 取得表中的记录
m_pRecordset->Open(bstrSQL,m_pConnection.GetInterfacePtr(),adOpenDynamic,adLockOptimistic,adCmdText);
}
// 捕捉异常
catch(_com_error e)
{
// 显示错误信息
AfxMessageBox(e.Description());
}
// 返回记录集
return m_pRecordset;
}
调用的方法是:
BOOL CDataGridDlg::OnInitDialog()
{
CDialog::OnInitDialog();
//原代码省略
// TODO: Add extra initialization here
//************************************************************
ADOConn m_ado;
_bstr_t vSql="select * from users";
_RecordsetPtr m_pRecordset;
m_ado.OnInitADOConn();
m_pRecordset=m_ado.GetRecordSet(vSql);
m_datagrid.SetRefDataSource((LPUNKNOWN)m_pRecordset);//m_datagrid为DataGrid控件的变量.
//************************************************************
return TRUE; // return TRUE unless you set the focus to a control
}
- "The rowset is not bookmarkable"出错
- "The rowset is not bookmarkable"出错
- "The rowset is not bookmarkable"错吴
- The rowset is not bookmarkable"错误
- A rowset based on the SQL command was not returned by the OLE DB provider
- XML配置出错导致HTTP404问题:The requested resource (/WebMailSys/Inbox) is not available.
- 安装weblogic 时出错:could not extract the archive since it is corrupted
- 装XP时出错,file setupdd.sys could not be loaded the error code is 4
- 闪回命令出错 ORA-08189: cannot flashback the table because row movement is not enabled
- iOS开发出错whose view is not in the window hierarchy!的解决
- 关于虚拟机出错的解决办法——The VMware Authorization Service is not running.
- mongodb 安装时出错 the defualt storage engine "wiredTiger" is not available 问题解决
- Arcgis发布服务出错显示:The server is not ready for publishing.
- 使用外置安装的zookeeper后hbase出错;ERROR: The node /hbase is not in ZooKeeper
- The word 'jsp' is not correctly spelled. Eclipse 拼写检查出错处理办法
- 引用DLL打包出错”But the dll is not allowed to be included or could not be found.“
- Evaluation is not mapped hql 语句出错
- The world is not enough
- 利用Oracle 10g的 MODEL SQL进行行间计算(2)
- 作业
- extern "C"
- 让所有控件同时更改为相同字体的方法
- ARM使用术语清除(flush)和清理(clean)表示对cache的两种基本操作
- "The rowset is not bookmarkable"出错
- 使用myeclipse使用hibernate配置
- 最近在用tomcat6 发表些心得
- 配置tommcat监听多个端口
- web开发之制作页面弹出窗口(form提交弹出式)
- 《暗黑破坏神 3》激情酷炫视频震撼公布【图】
- [zt]现在最流行的流行术语
- EXT提交服务器的三种方式(转)
- SNMP