清单10.14 自动注册DSN
#include “afxdb.h”
. . .
CDatabase db;
if(!SQLConfigDataSource(NULL,ODBC_ADD_DSN, "Microsoft FoxPro Driver (*.dbf)", 
"DSN=MYDB\0"
"DefaultDir=c:\\mydir\0"
"FIL=FoxPro 2.5\0"
"DriverId=280\0"))
{
AfxMessageBox("Can't add DSN!");
return ;
}
TRY
{
db.Open("MYDB");
}
CATCH(CDBException, e)
{
AfxMessageBox(e->m_strError);
return;
}
END_CATCH我这样作了,为什么出现这样的错误?C:\Windows\Desktop\a\aDlg.cpp(176) : error C2065: 'SQLConfigDataSource' : undeclared identifier
C:\Windows\Desktop\a\aDlg.cpp(176) : error C2065: 'ODBC_ADD_DSN' : undeclared identifier
C:\Windows\Desktop\a\aDlg.cpp(179) : warning C4129: '? : unrecognized character escape sequence
C:\Windows\Desktop\a\aDlg.cpp(179) : warning C4129: 'M' : unrecognized character escape sequence
C:\Windows\Desktop\a\aDlg.cpp(179) : warning C4129: 'd' : unrecognized character escape sequence
C:\Windows\Desktop\a\aDlg.cpp(181) : error C2110: cannot add two pointers
Error executing cl.exe.a.exe - 3 error(s), 3 warning(s)