Visual Studio 2013:c ++ 如何在这个功能 如果connection = false 显示消息并关闭 MessageBoxA(0,“无法连接到数据库!”,“错误”,MB_OK); :: ExitProcess的(0);
如果user,password,database = false 显示消息 它的ODBC连接,即使我写了User = WrongName和Password = WrongPassword仍在运行应用程序而没有错误连接到数据库,如果我更改Database = MuOnline2应用程序正在进行Loopssss并且甚至没有启动
我的.h文件
$rank1 = "1";
$rank2 = "2";
$rank3 = "3";
$array_rank = array();
for($x = 1; $x <= 3; $x++) {
$array_rank[$x] = ${'rank' . $x};
}
$array_rank_length = count($array_rank); //3
我的.cpp文件
#ifndef _SQLCONNECT_H
#define _SQLCONNECT_H
//-- SQL
#include <sql.h>
#include <sqltypes.h>
#include <sqlext.h>
//------
void ReadySQLConnect();
#define MAX_COLUMNS 100
class SQLCONNECT
{
public:
SQLCONNECT();
virtual ~SQLCONNECT();
BOOL Connect();
BOOL Execute(LPTSTR lpszStatement, ...);
void Close();
void GetAsString(LPTSTR ColName, LPTSTR pOutBuffer);
DWORD GetAsInteger(LPTSTR ColName);
QWORD GetAsInteger64(LPTSTR ColName);
float GetAsFloat(LPTSTR ColName);
void Disconnect();
int GetAsBinary(LPSTR lpszStatement, LPBYTE OUT lpszReturnBuffer);
SQLRETURN Fetch();
int GetResult(int iIndex);
QWORD GetResult64(int iIndex);
void SetAsBinary(LPTSTR lpszStatement, LPBYTE lpBinaryBuffer, SQLUINTEGER BinaryBufferSize);
DWORD GetRowCount();
BOOL ReConnect();
private:
int FindIndex(LPTSTR ColName);
void Diagnosis(char* Query);
protected:
SQLHANDLE m_hEnviroment;
SQLHANDLE m_hConnection;
SQLHANDLE m_hStmt;
TCHAR m_szUser[64];
TCHAR m_szPassword[64];
TCHAR m_szDatabase[64];
SQLINTEGER m_RowCount;
SQLSMALLINT m_ColCount;
SQLTCHAR m_SQLColName[MAX_COLUMNS][30];
TCHAR m_SQLData[MAX_COLUMNS][256];
SQLINTEGER m_SQLDataLen[MAX_COLUMNS];
};
extern SQLCONNECT cSQL;
void ReadyTableInstallation();
#endif