BOOL CRecordset::IsOpen() const
// Note: assumes base class CRecordset::Close called
{
if (m_hstmt == NULL)
return FALSE;
-----------//执行到这里显示错误! Expression Evaluator Error CXX0030
expression not evaluatable
.........
}这是什么原因?
// Note: assumes base class CRecordset::Close called
{
if (m_hstmt == NULL)
return FALSE;
-----------//执行到这里显示错误! Expression Evaluator Error CXX0030
expression not evaluatable
.........
}这是什么原因?
解决方案 »
- VC普通报表打印预览及打印控件?
- gsoap代理方式生成的代码,如何获取返回的XML文件?
- vc++实现把原先fprintf()打入的一行函数删去要用什么函数?
- kugou123(酷狗)(君看一叶舟,出没风波里)请接分
- 内存文件映射失败的奇怪问题
- CDC 和 GDI到底是什么关系啊 把我搞晕了?????????????????
- 关于CEdit的问题
- ****知道2个DATE类型的时间,求2个时间的差,有没有现成的函数?****
- 请问如何改变控件的风格?
- 关于32位dll 注入64位系统 里的32位程序和64位程序的疑惑
- ADO如何连数据库DB2、Oracle?不能使用ODBC数据源!急,急,急!
- ◆◆◆菜鸟系统:子类的使用方法?◆◆◆
[email protected]
/*****************************************************
功能:初始化视图,并连接数据源及将记录集与数据源连接在一
起.
历史纪录:andy-21/5/2002
******************************************************/
void CMyView::OnInitialUpdate()
{
CListView::OnInitialUpdate(); CListCtrl& ctrlList = (CListCtrl&) GetListCtrl();
// Gain a reference to the list control itself
ctrlList.SetExtendedStyle(LVS_EX_FULLROWSELECT);
m_pDatabase=new CDaoDatabase;//初始化数据源指针
try//异常
{
m_pDatabase->Open("library.mdb");//打开数据源
m_pRecordset=new CDaoRecordset(m_pDatabase);
m_pRecordset1=new CDaoRecordset(m_pDatabase);
//打开数据源相关的记录集
}
catch(CDaoException* e)
{
e->ReportError();
delete m_pDatabase;
m_pDatabase=NULL;
e->Delete();
return;
}
CString strKeyEntry;
///////////////////////////////////////////////////////
//从注册表中读出
strKeyEntry=_T("maxday");
m_maxday=AfxGetApp()->GetProfileInt( RegisteKeys, strKeyEntry,21 );
strKeyEntry=_T("maxbook");
m_maxbook=AfxGetApp()->GetProfileInt( RegisteKeys,strKeyEntry,3 );
strKeyEntry=_T("money");
CString money;
money=AfxGetApp()->GetProfileString( RegisteKeys, strKeyEntry,"0.2");
char *temp=money.GetBuffer(money.GetLength()+1);
m_money=atof(temp); ///////////////////////////////////////////////////////
// TODO: You may populate your ListView with items by directly accessing
// its list control through a call to GetListCtrl().
}
响应"证卡管理"->"撤户办理(&X)"
历史纪录:历史纪录:andy-24/5/2002
***************************************************************/
void CMyView::OnCardRelease()
{
m_strTableName=_T("用户信息");//设置当前操作的数据库表名称
//监测dao数据库对象的有效性,并在纪录集对象打开时关闭该记录集
if(!m_pDatabase->IsOpen())
return;
if(!m_pRecordset)
return;
if(m_pRecordset->IsOpen())
m_pRecordset->Close();
/////////////////////////////////////////////////////////
CCarddeleteuser dlg;
if(dlg.DoModal()!=IDOK)
return;
CString userid=dlg.m_userid;
//AfxMessageBox(userid);
CString strSql,str;
//////////////////////////////////////////////////////////
//判断是否是合法用户
strSql.Format("select * from 用户信息");
m_pRecordset->Open(dbOpenDynaset,strSql);
str.Format("读者号='%s'",userid);
if(!m_pRecordset->FindFirst(str))
{
str.Format("该用户未注册或输入错误,请确认输入!");
AfxMessageBox(str);
return;
}
m_pRecordset->Close();
//判断是否借有书
strSql.Format("select * from %s where 读者号='%s'",m_strTableName,userid);
m_pRecordset->Open(dbOpenDynaset,strSql);
str.Format("借阅书目个数>0");
if(m_pRecordset->FindFirst(str))
{
AfxMessageBox("该用户还借有图书,不能注销!");
return;
}
else
{
strSql.Format("delete from %s where 读者号='%s'",m_strTableName,userid);
}
try
{
if(m_pDatabase->CanUpdate())
m_pDatabase->Execute(strSql);
}
catch(CDaoException *e)
{
e->ReportError();
e->Delete();
return;
}
OnZhbbUserall();}