1, link to the Access database m_pConn-open (providerMicrosoft. jet. OLEDB.4.0; eclipsedatabasename;, adConnectionUnspecified); 2, link sqldatabase m_pConn-open (driverSQLOLEDB; server127.0.0.1; DataBasedatabasename; UID, PWD, adModeUnknown );
1, link to the Access database m_pConn-open (provider = Microsoft. jet. OLEDB.4.0; Data Sourse = DataBaseName;, adConnectionUnspecified); 2, link sqldatabase m_pConn-open (driver = SQLOLEDB; server = 127.0.0.1; DataBase = databasename; UID =, PWD = ,,, adModeUnknown );
1. Connect to the Access Database
M_pConn-> open ("provider = Microsoft. Jet. OLEDB.4.0; Data Sourse = DataBaseName;", "", adConnectionUnspecified );
2. Link to the SQL database
M_pConn-> open ("driver = SQLOLEDB; server =" 127.0.0.1 "; DataBase =" databasename "; UID =" ", PWD = ""","","", adModeUnknown );
When connecting to the SQL database, the Error is as follows:
1. The link string property is invalid.
The string may be incorrectly written.
2. The database does not exist or the access is denied.
The database does not monitor the corresponding port, or the client connection port is inconsistent with the database. 2. It may be caused by incorrect database settings. In the Configuration Manager, start the TCP/IP protocol and restart SQL server.
3. Unknown error
It may be that an error occurred while accessing PWD from the DAtaBase. 2. catch errors with try and catch.