The rowset is not bookmarkable"错误
来源:互联网 发布:php框架必须学码 编辑:程序博客网 时间:2024/06/04 19:36
用一个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"错吴
- web程序无法访问:The requested resource () is not available.错误
- “The string "--" is not permitted ...”的错误,解决方法
- 'The mysql driver is not currently installed'错误!!
- .net错误 resourcepool is not supported on the current platform
- 'The mysql driver is not currently installed'错误!!
- Access restriction: The constructor SunJCE() is not accessible 错误
- Access restriction: The constructor SunJCE() is not accessible 错误
- Omnet错误:the module is not linked with Define_Module()
- linux sudo xxx is not in the sudoers file错误
- List错误;The type List is not generic
- Centos下报“is not in the sudoers file”错误
- Access restriction: The XXXXXXX is not accessible 错误
- 怎样解决“XXX is not in the sudoers file”错误
- JRE_HOME错误 The JAVA_HOME environment variable is not defined correctly
- Java学习笔记三
- linux iptables 修改
- SQL 常用函数样列集
- x264运动估计宏块cost值的计算
- JS修改页面控件属性
- The rowset is not bookmarkable"错误
- 看linux是32位还是64位
- 如何用javascript操作本地文件(读写txt文件)
- 用C++封装的ADO类
- OPENCV 矩阵操作
- 泛型
- 包装类
- linux下如何设置无线网卡2
- kfs代码研究(七、网络部分)