VC访问数据库,作修改操作出现unhandled exception int ***怎么回事
解决方案 »
- 求解!!!!
- 请教一下我想用HTTPS进行网络通信,有什么有用的C++LIB库比较好用
- stdole2.tlb和stdole32.tlb这两个都提供了什么功能呢?
- ADO中怎么遍历存储过程的参数列表?
- 怎么判断 计算机是否装了 摄像头 ! 请求代码 最好 VC 的!
- 外包,做IE工具条,成都的最好
- self draw something in a child control, but it's out of range, how do I?
- 简单问题高手们请进...参与者有分!
- 如果我用atl写一个对sql数据库进行访问的组件,该如何写,大概说一下就行
- openGL怎么描画640*480分辨率的图片(有代码)
- 在问一个基础问题,CView::OnLButtonDown(nFlags, point);
- 到底是错哪里了?mschart绘制曲线闪烁问题!
http://msdn.microsoft.com/en-us/library/19b8k939(v=VS.80).aspx
ODBC Exception Example
The Open member function could throw an exception (of type CDBException for the ODBC classes), so this code brackets the Open call with a try block. The subsequent catch block will catch a CDBException. You could examine the exception object itself, called e, but in this case it is enough to know that the attempt to create a recordset has failed. The catch block displays a message box and cleans up by deleting the recordset object. CopyCRecordset* CSectionView::OnGetRecordset()
{
if ( m_pSet != NULL )
return m_pSet; // Recordset already allocated m_pSet = new CSectionSet( NULL );
try
{
m_pSet->Open( );
}
catch( CDBException* e )
{
AfxMessageBox( e->m_strError,
MB_ICONEXCLAMATION );
// Delete the incomplete recordset object
delete m_pSet;
m_pSet = NULL;
e->Delete();
}
return m_pSet;
}
DAO Exception Example
The DAO example is similar to the example for ODBC, but you can typically retrieve more kinds of information. The following code also attempts to open a recordset. If that attempt throws an exception, you can examine a data member of the exception object for error information. As with the previous ODBC example, it is probably enough to know that the attempt to create a recordset failed. CopyCDaoRecordset* CSectionView::OnGetRecordset()
{
if ( m_pSet != NULL )
return m_pSet; // Recordset already allocated m_pSet = new CSectionSet( NULL );
try
{
m_pSet->Open( );
}
catch( CDaoException* e )
{
AfxMessageBox(
e->m_pErrorInfo->m_strDescription,
MB_ICONEXCLAMATION );
// Delete the incomplete recordset object
delete m_pSet;
m_pSet = NULL;
e->Delete();
}
return m_pSet;
}