資源簡介
本系統通過ado方式連接access數據庫,實現學生信息表的增刪改查等操作

代碼片段和文件信息
//?ADOAccess.cpp?:?Defines?the?class?behaviors?for?the?application.
//
#include?“stdafx.h“
#include?“ADOAccess.h“
#include?“ADOAccessDlg.h“
#ifdef?_DEBUG
#define?new?DEBUG_NEW
#undef?THIS_FILE
static?char?THIS_FILE[]?=?__FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
//?CADOAccessApp
BEGIN_MESSAGE_MAP(CADOAccessApp?CWinApp)
//{{AFX_MSG_MAP(CADOAccessApp)
//?NOTE?-?the?ClassWizard?will?add?and?remove?mapping?macros?here.
//????DO?NOT?EDIT?what?you?see?in?these?blocks?of?generated?code!
//}}AFX_MSG
ON_COMMAND(ID_HELP?CWinApp::onhelp)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
//?CADOAccessApp?construction
CADOAccessApp::CADOAccessApp()
{
//?TODO:?add?construction?code?here
//?Place?all?significant?initialization?in?InitInstance
}
/////////////////////////////////////////////////////////////////////////////
//?The?one?and?only?CADOAccessApp?object
CADOAccessApp?theApp;
/////////////////////////////////////////////////////////////////////////////
//?CADOAccessApp?initialization
BOOL?CADOAccessApp::InitInstance()
{
AfxEnableControlContainer();
//初始換comm環境創建ADO連接
AfxOleInit();
//CoInitialize(NULL);
m_pConnection.CreateInstance(__uuidof(Connection));
try{
m_pConnection->Open(“Provider=Microsoft.Jet.OLEDB.4.0;Data?Source=student.mdb“““““adModeUnknown);
}
catch(_com_error?e)
{
AfxMessageBox(“數據庫連接失敗確定數據庫student.mdb是否在當前目錄中“);
return?FALSE;
}
//?Standard?initialization
//?If?you?are?not?using?these?features?and?wish?to?reduce?the?size
//??of?your?final?executable?you?should?remove?from?the?following
//??the?specific?initialization?routines?you?do?not?need.
#ifdef?_AFXDLL
Enable3dControls(); //?Call?this?when?using?MFC?in?a?shared?DLL
#else
Enable3dControlsStatic(); //?Call?this?when?linking?to?MFC?statically
#endif
CADOAccessDlg?dlg;
m_pMainWnd?=?&dlg;
int?nResponse?=?dlg.DoModal();
if?(nResponse?==?IDOK)
{
//?TODO:?Place?code?here?to?handle?when?the?dialog?is
//??dismissed?with?OK
}
else?if?(nResponse?==?IDCANCEL)
{
//?TODO:?Place?code?here?to?handle?when?the?dialog?is
//??dismissed?with?Cancel
}
//?Since?the?dialog?has?been?closed?return?FALSE?so?that?we?exit?the
//??application?rather?than?start?the?application‘s?message?pump.
????return?TRUE;
}
int?CADOAccessApp::ExitInstance()
{
if(m_pConnection->GetState())
{
m_pConnection->Close();
m_pConnection?=?NULL;
}
return?CWinApp::ExitInstance();
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件??????36196??2015-08-10?15:25??ADOAccess\ADOAccess.aps
?????文件???????1588??2015-08-10?15:46??ADOAccess\ADOAccess.clw
?????文件???????2657??2015-08-10?15:43??ADOAccess\ADOAccess.cpp
?????文件???????4213??2015-08-10?08:49??ADOAccess\ADOAccess.dsp
?????文件????????524??2015-08-10?08:49??ADOAccess\ADOAccess.dsw
?????文件???????1421??2015-08-10?15:43??ADOAccess\ADOAccess.h
?????文件?????246784??2015-08-10?15:46??ADOAccess\ADOAccess.ncb
?????文件??????55808??2015-08-10?15:46??ADOAccess\ADOAccess.opt
?????文件????????252??2015-08-10?15:43??ADOAccess\ADOAccess.plg
?????文件???????5958??2015-08-10?15:25??ADOAccess\ADOAccess.rc
?????文件???????8561??2015-08-10?15:38??ADOAccess\ADOAccessDlg.cpp
?????文件???????1691??2015-08-10?15:33??ADOAccess\ADOAccessDlg.h
?????文件?????127048??2015-08-10?15:43??ADOAccess\Debug\ADOAccess.exe
?????文件?????381004??2015-08-10?15:43??ADOAccess\Debug\ADOAccess.ilk
?????文件??????44498??2015-08-10?15:43??ADOAccess\Debug\ADOAccess.obj
?????文件????6928340??2015-08-10?14:04??ADOAccess\Debug\ADOAccess.pch
?????文件?????615424??2015-08-10?15:43??ADOAccess\Debug\ADOAccess.pdb
?????文件???????2924??2015-08-10?15:25??ADOAccess\Debug\ADOAccess.res
?????文件??????98620??2015-08-10?15:43??ADOAccess\Debug\ADOAccessDlg.obj
?????文件?????222015??2012-06-06?13:05??ADOAccess\Debug\msado15.tlh
?????文件?????167300??2012-06-06?13:05??ADOAccess\Debug\msado15.tli
?????文件?????132915??2015-08-10?14:04??ADOAccess\Debug\StdAfx.obj
?????文件?????246784??2015-08-10?15:43??ADOAccess\Debug\vc60.idb
?????文件?????577536??2015-08-10?15:43??ADOAccess\Debug\vc60.pdb
?????文件?????221931??2012-06-06?13:05??ADOAccess\msado15.tlh
?????文件?????167258??2012-06-06?13:05??ADOAccess\msado15.tli
?????文件???????3633??2015-08-10?08:49??ADOAccess\ReadMe.txt
?????文件???????1078??2015-08-10?08:49??ADOAccess\res\ADOAccess.ico
?????文件????????401??2015-08-10?08:49??ADOAccess\res\ADOAccess.rc2
?????文件???????1055??2015-08-10?15:25??ADOAccess\resource.h
............此處省略9個文件信息
評論
共有 條評論