MFC +msyql ++取回异常文本的有关问题====已解决请管理帮忙结贴

MFC +msyql ++取回错误文本的问题在线等====已解决请管理帮忙结贴
本帖最后由 youjie110 于 2013-07-08 23:34:52 编辑
MFC  +msyql ++取回异常文本的有关问题====已解决请管理帮忙结贴
#include <winsock.h>
#include <mysql.h>
#include <list>
/* 定义记录结构 */
class RecStruct
{
public:
char stuId[5 + 1];
char stuName[8 + 1];
char stuSex[2 + 1];
char birth[21 + 1];
char brief[200 + 1];
/* 实始化成员 */
RecStruct()
{
memset(stuId, 0, sizeof(stuId));
memset(stuName, 0, sizeof(stuName));
memset(stuSex, 0, sizeof(stuSex));
memset(birth, 0, sizeof(birth));
memset(brief, 0, sizeof(brief));
}
};

class msyql  
{
public:
std::list<RecStruct>  GetAllRec();
void 关闭();
unsigned int 取错误代码();
const char *取错误文本();
BOOL 链接(const char *host, const char *user, const char *passwd, const char* dbName);
//DbOnMySql();
//virtual ~DbOnMySql();
private:
MYSQL m_mysql;
};




#include "stdafx.h"
#include"msyql_tool.h"

/* 建立与数据库的连接 */
BOOL msyql::链接(const char *host, 
   const char *user, 
   const char *passwd,
   const char* dbName)
{
/* 初始化MYSQL结构 */
mysql_init(&m_mysql);

/* 连接数据库 */
if(mysql_real_connect(&m_mysql, host, user, passwd, 
dbName, 0, NULL, 0) != NULL)
{//成功建立连接
return TRUE;
}
else
{//建立连接失败
return FALSE;
}
}
/* 关闭数据库连接 */
void msyql::关闭()
{
mysql_close(&m_mysql);
}

//取错误代码
 unsigned int msyql::取错误代码()
{
return  mysql_errno(&m_mysql);
}
//取错误文本
 /*const char *mysql_error(MYSQL *mysql) */
 const char *msyql::取错误文本()
 {
return  mysql_error(&m_mysql);
 }



求助,取回错误的链接文本,是乱码,,!

------解决方案--------------------
必须有非LZ的人回复才可以结贴,否则的话就是不满意结贴。
------解决方案--------------------
“不满意结贴”
分就 浪费了 !
------解决方案--------------------
自己结掉不就完了
为什么要管理员帮忙