Search code examples
sql-servervisual-c++oledbdatabase-connection

Cannot connect to remote MS SQL Server Express 2008 R2 from OLE DB


I cannot connect to remote MS SQL server express 2008 R2. On the server, the external connection is enabled, firewall is turned off. When my friend tried to connect using python, everything is OK. I am using Visual C++ and OLE DB under VS 2010.

Error I get is:

[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

Thanks


Solution

  • the solution is to use Open method of CDataSource clas instead of OpenFromInitializationString..