With Visual C++ 4.2 and later versions, specify the CDatabase::noOdbcDialog option as the second argument to CDatabase::OpenEx(). This will cause CDatabase::OpenEx() to call SQLDriverConnect with the SQL_DRIVER_NOPROMPT flag.
因为连接需要足够的信息,所以失败,可能是因为需要输入密码和用户名。 OpenEx()参数中有一项,可以设置为CDatabase::noOdbcDialog, CDatabase::noOdbcDialog Do not display the ODBC connection dialog box, regardless of whether enough connection information is supplied 也就是说,即使没有足够的信息,也不弹出输入连接信息对话框。
OpenEx()参数中有一项,可以设置为CDatabase::noOdbcDialog,
CDatabase::noOdbcDialog Do not display the ODBC connection dialog box, regardless of whether enough connection information is supplied
也就是说,即使没有足够的信息,也不弹出输入连接信息对话框。