📄 example.cpp
字号:
// Example.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "Example.h"
#include "afxdao.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// The one and only application object
CWinApp theApp;
using namespace std;
int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
int nRetCode = 0;
// initialize MFC and print and error on failure
if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
{
// TODO: change error code to suit your needs
cerr << _T("Fatal Error: MFC initialization failed") << endl;
nRetCode = 1;
}
else
{
// TODO: code your application's behavior here.
AfxGetModuleState()->m_dwVersion = 0x0601;
AfxDaoInit();
CDaoDatabase m_MyDatabase;
m_MyDatabase.Open("F:\\vc6150\\Chap5-数据库\\BIBLIO.MDB");
CString str1="Select * from [Authors]";
CDaoRecordset m_MyRS(&m_MyDatabase);
m_MyRS.Open(dbOpenDynaset,str1);
if (m_MyRS.IsBOF()&&m_MyRS.IsEOF())
{
printf("There aren't any records in recordset!\n");
}
else
{
m_MyRS.MoveLast();
printf("There are %d records in recordset!\n",m_MyRS.GetRecordCount());
}
m_MyRS.Close();
m_MyDatabase.Close();
}
return nRetCode;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -