📄 openingadorecordsetwithmfcole.cpp
字号:
// OpeningADORecordsetWithMFCOLE.cpp : Defines the class behaviors for the application.
//
#include "stdafx.h"
#include "OpeningADORecordsetWithMFCOLE.h"
#include "msado15.h"
struct InitOle {
InitOle() { ::CoInitialize(NULL); }
~InitOle() { ::CoUninitialize(); }
} _init_InitOle_;
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// COpeningADORecordsetWithMFCOLEApp
BEGIN_MESSAGE_MAP(COpeningADORecordsetWithMFCOLEApp, CWinApp)
//{{AFX_MSG_MAP(COpeningADORecordsetWithMFCOLEApp)
//}}AFX_MSG
ON_COMMAND(ID_HELP, CWinApp::OnHelp)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// COpeningADORecordsetWithMFCOLEApp construction
COpeningADORecordsetWithMFCOLEApp::COpeningADORecordsetWithMFCOLEApp()
{
}
/////////////////////////////////////////////////////////////////////////////
// The one and only COpeningADORecordsetWithMFCOLEApp object
COpeningADORecordsetWithMFCOLEApp theApp;
/////////////////////////////////////////////////////////////////////////////
// COpeningADORecordsetWithMFCOLEApp initialization
BOOL COpeningADORecordsetWithMFCOLEApp::InitInstance()
{
_Recordset Rs1;
COleException e;
COleVariant Connect( "DSN=AdoDemo;UID=admin;PWD=;" );
COleVariant Source ( "SELECT * FROM Authors" );
Rs1.CreateDispatch( "ADODB.Recordset.1.5", &e );
Rs1.Open( (VARIANT) Source, (VARIANT) Connect, 0, 1, -1 );
Rs1.Close();
Rs1.ReleaseDispatch();
AfxMessageBox("Success!");
// Since the dialog has been closed, return FALSE so that we exit the
// application, rather than start the application's message pump.
return FALSE;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -