Problem analysis has been a long time,
After troubleshooting, the problem is that there is a problem with the startup path of the database. You can write this way when connecting to the database.
GetModuleFileName(NULL, path,255);//Get the complete path of the self-started program;
CString str;
("%s",path);
int place;
place = ( '\\' ); //Get the last '\' position;
CString db_name;
db_name = (place+1) + ""; //Integrate the complete path of the access database
CString connect; //The first parameter of the connection
connect = "Provider=.4.0;Data Source=" + db_name + ";";
hr = theApp.m_pConnection->(()),"","",adModeUnknown); //Parses are brought in and connected
The rest of the code does not need to be changed.
After troubleshooting, the problem is that there is a problem with the startup path of the database. You can write this way when connecting to the database.
GetModuleFileName(NULL, path,255);//Get the complete path of the self-started program;
CString str;
("%s",path);
int place;
place = ( '\\' ); //Get the last '\' position;
CString db_name;
db_name = (place+1) + ""; //Integrate the complete path of the access database
CString connect; //The first parameter of the connection
connect = "Provider=.4.0;Data Source=" + db_name + ";";
hr = theApp.m_pConnection->(()),"","",adModeUnknown); //Parses are brought in and connected
The rest of the code does not need to be changed.