Home > Software engineering > ADO connection to the database in MFC into msado15. Tli GetCollect function of error
ADO connection to the database in MFC into msado15. Tli GetCollect function of error
Time:09-23
The inline _variant_t Recordset15: : GetCollect (const _variant_t & amp; The Index) { The VARIANT _result; VariantInit (& amp; _result); HREULT _hr=get_Collect (Index, & amp; _result); If (FAILED (_hr)) _con_issue_errorex (_hr, this __uuidof (this)); Return _variant_t (_result, flase); } Call this function statements for: M_listCtrl. SetItemText (0, 0, (LPCTSTR) (_bstr_t) ado. M_Recordset - & gt; GetCollect (_variant_t (0) (long))); Holds the record set for the first column of the data on m_listCtrl controls the position of the first line of the first column, The first run the program is good, the second time will take the same data error, error message: 0 x045f637b had untreated exception: 0 xc0000005: read position 0 xfeeeff4e when an exception occurs
CodePudding user response:
Look from your description and your code, you seems to be the current record will be moved to the to the location of the BOF or EOF
CodePudding user response:
Yes, Whie (! Ado. M_Recordset - & gt; AdoEOF) { M_listCtrl. SetItemText (0, 0, (LPCTSTR) (_bstr_t) ado. M_Recordset - & gt; GetCollect (_variant_t (0) (long))); M_listCtrl. SetItemText (0, 1, (LPCTSTR) (_bstr_t) ado. M_Recordset - & gt; GetCollect (_variant_t ((long), 1))); } ado. Close; Click the play button key take data, press the button again next time just make a mistake,
CodePudding user response:
Do you want to realize what is the function of every time before entering the while put the position to the first try