/*
Cstrings strSQL;
StrSQL. The Format (_T (" select * from employees where employee number='% s' order by employee number desc "), strNum);
_bstr_t bstrSQL;
StrSQL bstrSQL=(_bstr_t);
//in m_pRecordset - every time & gt; Open () function error!!!!!!
*/
_bstr_t bstrSQL=_T (" select * from employees where employee number=6 order by employee number desc ");
//success!!!!!!
//create a recordset pointer to the object instance
M_pRecordset. CreateInstance (__uuidof (you));
//open the recordset
M_pRecordset - & gt; Open (bstrSQL, m_pConnection GetInterfacePtr (), adOpenDynamic, adLockOptimistic, adCmdText);
M_pRecordset - & gt; MoveFirst ();
CodePudding user response:
http://wenku.baidu.com/link? Url=FEKplJHbUfKjqb2ucHxUXDeiEPBTmZqYoLQUB64boIRJ8XIm2yOKkxlrXmHIHuRFhy4xRIbT8WFSRVjRV9AR8hbrE9Q7dYnJTaGuJ_euxTq