📄 adodatabase.h
字号:
#if !defined(AFX_ADODATABASE_H__5FA494E6_197A_4CEA_8A14_E29829F24785__INCLUDED_)
#define AFX_ADODATABASE_H__5FA494E6_197A_4CEA_8A14_E29829F24785__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// AdoDatabase.h : header file
//
//////////////////////////////////////////////////////////////////////////////
//
// Author X
//
// Designed Date 08-4-17
//
// Funtion It is a simple class that operate database by ado mode
//
//
/////////////////////////////////////////////////////////////////////////////
// #import "c:\program files\common files\system\ado\msado15.dll" \
// no_namespace rename("EOF","adoEOF")
//
// Insert last sentence in "StdAfx.h"
// CAdoDatabase document
struct AdoDatabaseInfo
{
CString DataSouceName; // g_ global variant
CString DatabaseName;
CString TableName;
};
class CAdoDatabase : public CDocument
{
public:
// Attributes
_ConnectionPtr m_pConnection;
_RecordsetPtr m_pRecordset;
public:
// Base Operations
void SetAdoDatabaseInfo(AdoDatabaseInfo adodatabaseinfo); // Run this function before ConnectDatabase()
AdoDatabaseInfo GetAdoDatabaseInfo();
bool ConnectDatabase();
bool OpenDatabase();
bool AddNewData(CString StrAddData); // Add a new record;
CString GetData(CString VarName,int SelectRow); // Get one data ( the number of SQL field )from specify position
CString GetData(int SelectRow); // Get all of SQL field data from specify position
// if run fail return ERROR
int GetRecordCount(); // Get the number of Record
bool DeleteData(int SelectRow); // Delete data at specify position
bool DeleteAllRecord();
bool ModifyData(CString VarName, CString NewValue, int SelectRow); // VarName / Variant name in SQL
bool ModifyData(CString StrSendData, int SelectRow);
public:
// Attributes
CString g_DataSouceName; // g_ global variant
CString g_DatabaseName;
CString g_TableName;
int FieldNum; // The number of Table fields
public:
CAdoDatabase(); // protected constructor used by dynamic creation
DECLARE_DYNCREATE(CAdoDatabase)
// Attributes
public:
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAdoDatabase)
public:
virtual void Serialize(CArchive& ar); // overridden for document i/o
protected:
virtual BOOL OnNewDocument();
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CAdoDatabase();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
// Generated message map functions
protected:
//{{AFX_MSG(CAdoDatabase)
// NOTE - the ClassWizard will add and remove member functions here.
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_ADODATABASE_H__5FA494E6_197A_4CEA_8A14_E29829F24785__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -