Home > Back-end >  Help: c ADO connection SQL2008 running very slow problem
Help: c ADO connection SQL2008 running very slow problem

Time:10-18

Void ADOConn: : OnInitADOConn ()
{
//initialize
: : CoInitialize (NULL);
Try
{
M_pConnection. CreateInstance (" ADODB. Connection ");
//set the connection string
_bstr_t strConnect="driver=SQL Server; Server=HY - PC; The DATABASE=SignInSystem; UID=hy. The PWD=hy1991119 ";
M_pConnection - & gt; Open (strConnect, ""," ", adModeUnknown);
}
Catch _com_error (e)
{
AfxMessageBox (e.D escription ());
}
}

Above is the 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, but the code running very slow debugging found in m_pConnection - & gt; Open (strConnect, ""," ", adModeUnknown); This sentence, the program will stop 2 seconds to jump to the next, and the great spirit analysis the problem in where?

CodePudding user response:

First connection estimates are unhappy, you have a connection speed test used to other version?

CodePudding user response:

Before I use c + + builder and ADO database connection, feeling soon ah, I don't know what is the original poster with environment

CodePudding user response:

To replace the name of the Server with the corresponding IP to try again,

CodePudding user response:

Increasing the speed of your network

CodePudding user response:

Arguably, the Microsoft offer native ado, theory is better than other similar ADOQuery components, speed is much faster
  • Related