Home > Software engineering >  MFC database link m_pConnection. CreateInstance (" ADODB. Connection ")
MFC database link m_pConnection. CreateInstance (" ADODB. Connection ")

Time:10-27

The code is as follows:
Void ADOConn: : OnInitADOConn ()//link database
{
Try
{
CoInitialize (NULL);
M_pConnection. CreateInstance (" ADODB. Connection ");//create a linked object instance, when debugging this sentence is wrong!!!!!
The Provider=_bstr_t strConnect="MSDAORA. 1; Password=MRLRN; \
User ID=system; Data Source=mrLRN; Persist Security Info=True ";
M_pConnection - & gt; Open (strConnect, ""," ", adModeUnknown);//open the database
}
Catch _com_error (e)
{
AfxMessageBox (e.D escription ());//the pop-up error handling
}
}


My small white
What is this?
I have been in the stdafx. Add in the h # import "c: \ Program Files \ Common Files \ System \ ado \ msado15 DLL" no_namespace \
Rename (" EOF adoEOF ", "") rename (" BOF," "adoBOF")
I use the SQL command line, and input the conn username/password to use, don't need not input on MFC?

CodePudding user response:

Feeling is ado by oracle preempted the oracle on your system

CodePudding user response:

CodePudding user response:

Try to use ADO assistant,

CodePudding user response:

Did you set the wrong data??
  • Related