Error:
C: \ Program Files \ Microsoft Visual Studio \ MyProjects \ StudentTest \ ADOConn CPP (60) : error C2511: 'GetRecordSet: overloaded member function,' class _com_ptr_t & lt; The class _com_IIID & lt; Struct _Recordset, & amp; Struct __s_GUID _GUID_00000556_0000_0010_8000_00aa006d2ea
4> & (class _bstr_t) 'not found in the' ADOConn '
Below is the code
_RecordsetPtr & amp; ADOConn: : GetRecordSet (_bstr_t bstrSQL)
{
Try
{
If (m_pCon==NULL)
{
OnInitADOConn ();//determine whether Connection object is empty
}
M_pRs. CreateInstance ();//if the empty to connect to the database
//get the data in the table data
M_pRs - & gt; Open (bstrSQL, m_pCon GetInterfacePtr (), adOpenDynamic, adLockOptimistic, adCmdText);
}
Catch _com_error (e)//catch exceptions
{
AfxMessageBox (e.D escription ());//display information
}
Return m_pRs;//return record sets
}
CodePudding user response:
# include & lt; Comutil. H>CodePudding user response:
Pay attention to type conversion, etc