How to make in this function
if connection = false
show message and close
MessageBoxA(0, "Failed to connect to Database!", "Error", MB_OK);
::ExitProcess(0);
if user, password, database = false
show message
BOOL SQLCONNECT::Connect()
{
GetPrivateProfileStringA("SQL", "User", "sa", this->m_szUser, 64, SQL_PATH);
GetPrivateProfileStringA("SQL", "Password", "123456", this->m_szPassword, 64, SQL_PATH);
GetPrivateProfileStringA("SQL", "Database", "MuOnline", this->m_szDatabase, 64, SQL_PATH);
SQLHANDLE rgbValue;
SQLAllocHandle(SQL_HANDLE_DBC, this->m_hEnviroment, &this->m_hConnection);
SQLSetConnectAttr(this->m_hConnection, SQL_LOGIN_TIMEOUT, &rgbValue, 0);
SQLRETURN Result = SQLConnect(this->m_hConnection, (SQLTCHAR *)this->m_szDatabase, SQL_NTS,
(SQLTCHAR *)this->m_szUser, SQL_NTS, (SQLTCHAR *)this->m_szPassword, SQL_NTS);
if (Result != SQL_SUCCESS && Result != SQL_SUCCESS_WITH_INFO)
{
SQLSMALLINT sRecord = 1, MsgLen;
SQLTCHAR SqlState[6], SQLMsgError[SQL_MAX_MESSAGE_LENGTH];
SQLINTEGER NativeError;
if (SQLGetDiagRec(SQL_HANDLE_DBC, this->m_hConnection, sRecord, SqlState, &NativeError, SQLMsgError, sizeof(SQLMsgError), &MsgLen) != SQL_NO_DATA)
{
}
return FALSE;
}
Result = SQLAllocHandle(SQL_HANDLE_STMT, this->m_hConnection, &this->m_hStmt);
if (Result != SQL_SUCCESS && Result != SQL_SUCCESS_WITH_INFO)
{
return FALSE;
}
ReadyTableInstallation();
return TRUE;
}