{
//initialize the OLE/COM library environment
: : CoInitialize (NULL);
Try
{
//create a connection object
//equivalent to the following statements: m_pConnection CreateInstance (" ADODB. Connection ");
M_pConnection. CreateInstance (__uuidof (Connection));
//set the connection string
The Provider=_bstr_t strConnect="SQLOLEDB. 1; Integrated Security=SSPI; \
Persist Security Info=False; Initial Catalog=WenDGL; The Data Source=. \ \ ";
//the SERVER and the UID and PWD set according to the actual situation to set the
M_pConnection - & gt; Open (strConnect, ""," ", adModeUnknown);
}
//the catching
Catch _com_error (e)
{
//display an error message
AfxMessageBox (e.D escription ());
}
}
Connection part of the code, the code itself has no problems, the connection can be successful, insert, query and so on, there is no problem next steps, is to run slow
After debugging found m_pConnection - & gt; Open (strConnect, ""," ", adModeUnknown); Running very slow, such as more than 10 seconds to respond
Using SQL server 2008 and vs2010 MFC
CodePudding user response:
Using XP provides ADOCodePudding user response:
I put the msado15. DLL file into the xp version 2.81, useless, or slowlyCodePudding user response:
If there is something wrong with the connection string parameters, can use ADO assistants under test,CodePudding user response: