⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 db.h

📁 vc连接mysql范例。包括创建数据源
💻 H
字号:
// STMSDateBaseDLL.h : main header file for the STMSDATEBASEDLL DLL
//

#if !defined(AFX_STMSDATEBASEDLL_H__114EB9AD_A1D1_4C76_817E_91C2075ABC97__INCLUDED_)
#define AFX_STMSDATEBASEDLL_H__114EB9AD_A1D1_4C76_817E_91C2075ABC97__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#ifndef __AFXWIN_H__
	#error include 'stdafx.h' before including this file for PCH
#endif

//#include "resource.h"		// main symbols

#define ERROR_INSERT_RECORD			-6	//数据库增错误
#define ERROR_CONNECT				-3	//数据库连接错误
#define ERROR_NOT_FOUND_RECORD		-5	//数据库记录没有找到
#define ERROR_ADMIN_HAS_EMPTY_FIELD -2	//写入数据时所有表字段不允许为空
#define ERROR_WRITE_EXCEPTION		-4	//写入字段异常
#define ERROR_DELETE_EXCEPTION		-7	//删除记录异常
#define ERROR_OPEN_TABLE			-1	//打开数据库表异常
#define CORRECT_RETURN_INTERFACE	1	//接口函数正常返回
#define ERROR_TABLE_EXIT			-7	//数据库该表已存在
#define ERROR_SQL_OPERTATION		-8	//sql语句操作数据库异常
#define ERROR_ADMIN_EXIST			-9	//用户名不存在
#define ERROR_PASS_INEXIST			-10	//密码不正确
#define FIELDVALUE_EXIST			2	//表字段存在
#define	FIELDVALUE_NOTEXIST			3	//表字段不存在
#define ERROR_FIELDVALUE_FIND		-11	//查找表字段异常
#define ERROR_UNKNOW				-13	//未知错误
#define ERR_CON_DS					-14	//连接数据源错误
#define ERROR_CONNECT_IP			-15	//IP地址不正确
#define ERROR_ORGAN_QUERY			-16	//机构为空
/////////////////////////////////////////////////////////////////////////////
// CSTMSDateBaseDLLApp
// See STMSDateBaseDLL.cpp for the implementation of this class
//

class db //: public CWinApp
{
public:
	db();
	_ConnectionPtr m_pConnection;
	_RecordsetPtr m_pRecordset;
	_CommandPtr	m_pCommand;
	FILE *f;
	int initADOConnect(char* conIp , char* conPass , int conPort ,
				   char* conUser , char* conDS , char* conDB);	//ado 初始工作
	void ExitConnect();
	void writeIntoRecordFile(CString content,FILE* file);
	int sql_sentence_operate(char* tableName,char* sqlsch);
	/*
	//int tableExit(CString tableName,CString dataBaseName);
// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CSTMSDateBaseDLLApp)
	public:
	//virtual BOOL InitInstance();
	//}}AFX_VIRTUAL

	//{{AFX_MSG(CSTMSDateBaseDLLApp)
		// NOTE - the ClassWizard will add and remove member functions here.
		//    DO NOT EDIT what you see in these blocks of generated code !
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()*/
};


/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_STMSDATEBASEDLL_H__114EB9AD_A1D1_4C76_817E_91C2075ABC97__INCLUDED_)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -