64,647
社区成员
发帖
与我相关
我的任务
分享
CLx1Dlg::CLx1Dlg(CWnd* pParent /*=NULL*/)
: CDialog(CLx1Dlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CLx1Dlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
//链接数据表
m_pRecordset.CreateInstance(_uuidof(Recordset));
HRESULT Open(const _variant_t & Source,const _variant_t & ActiveConnection,enum CursorTypeEnum CursorType,enum LockTypeEunm LockType,long Options);
CString strSQL="select * from cangku";
try
{
//从数据库中打开表
m_pRecordset->Open(_bstr_t(strSQL),m_pConnection.GetInterfacePtr(),adOpenDynamic,adLockOptimistic,adCmdText);
}
catch(_com_error e)
{
CString strError;
strError.Format("警告:打开数据表时发生异常。错误信息:%s",e.ErrorMessage());
AfxMessageBox(strError);
return;
}
}