这个连接MySQL数据库的字符串有什么问题?有人知道吗?
int mlen;
char *szDesc = new char[256];
sprintf(szDesc, "Driver={MySQL ODBC 3.51 Driver}? SERVER=localhost? DATABASE=databasemmib? UID=root? PWD=abcd?? ");
mlen = strlen(szDesc);
for (int i=0; i <mlen; i++)
{
if (szDesc[i] == '? ')
szDesc[i] = '\0 ';
}
if (FALSE == SQLConfigDataSource(NULL,ODBC_ADD_SYS_DSN, "MySQL ODBC 3.51 Driver\0 ",(LPCSTR)szDesc))
{
AfxMessageBox( "failed! ");
}
else
{
AfxMessageBox( "succeed! ");
}
为什么老是提示失败呢?有谁能给看看吗
------解决方案-------------------- "Driver={MySQL ODBC 3.51 Driver};SERVER=localhost;DATABASE=yourDatabase;USER=youUsername;PASSWORD=yourPassword;OPTION=3; "