在vc中使用ado打开数据库的时候,用到了这样的代码:_ConnectionPtr m_pConnection;
_RecordsetPtr m_pRecordset; m_pConnection.CreateInstance(_uuidof(Connection));
m_pRecordset.CreateInstance(_uuidof(Recordset));m_pConnection->Open("xxxx" ,"","",0);
m_pRecordset->Open("xx", m_pConnection.GetInterfacePtr () ,adOpenDynamic,adLockOptimistic, 1); 在 m_pRecordset->Open 一句中使用到了 m_pConnection.GetInterfacePtr()
可是 m_pConnection 明明定义成一个类对象,应该使用 -> 才对,为什么使用了 . 呢?
_RecordsetPtr m_pRecordset; m_pConnection.CreateInstance(_uuidof(Connection));
m_pRecordset.CreateInstance(_uuidof(Recordset));m_pConnection->Open("xxxx" ,"","",0);
m_pRecordset->Open("xx", m_pConnection.GetInterfacePtr () ,adOpenDynamic,adLockOptimistic, 1); 在 m_pRecordset->Open 一句中使用到了 m_pConnection.GetInterfacePtr()
可是 m_pConnection 明明定义成一个类对象,应该使用 -> 才对,为什么使用了 . 呢?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货