_ConnectionPtr m_pConn;_variant_t RecordsAffected;if (FAILED(m_pConn.CreateInstance("ADODB.Connection"))){AfxMessageBox(_T("Create Instance failed!"));return;}else{m_pConn->Open("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C://Users//liu//Desktop//database1.mdb", "", "", adModeUnknown);try{CString sql = _T("INSERT INTO user(username,password) VALUES("" + UserName + "","" + Password + "")");AfxMessageBox(sql); //察看插入代码是否有问题m_pConn->Execute((_bstr_t)sql, &RecordsAffected, adCmdText);}catch (_com_error &e){AfxMessageBox(_T("喵喵喵"));m_pConn->Close();}m_pConn->Close();}报错信息是这个:inline HRESULT Connection15::Close ( ) {HRESULT _hr = raw_Close();if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this));return _hr;}
添加回答
举报
0/150
提交
取消