AfxOleInit();
_ConnectionPtr connstr;
_RecordsetPtr rs;
//try{
connstr.CreateInstance(_uuidof(Connection));
rs.CreateInstance(_uuidof(Recordset));
connstr->ConnectionString = "File Name=E:\\moblenet\\Ts.UDL";
connstr->Open("","","",NULL);////这句这什么老出错??
CString SQL="select * from sys_member";
BSTR BSTRSQL=SQL.AllocSysString();
rs->Open(BSTRSQL,(IDispatch*)connstr,adOpenDynamic,adLockOptimistic,0);
while (!rs->adoEOF){
_variant_t TheValue;
TheValue = rs->GetCollect("UserName");
CString StrValue;
TheValue.SetString(StrValue);
//AfxMessageBox(TheValue);
TRACE("字符串值=%s/r",StrValue);
rs->MoveNext();
}
rs->Close();
/*}
catch (_com_error e)
{
AfxMessageBox(e.ErrorMessage());
}*/
rs=NULL;
connstr=NULL;
_ConnectionPtr connstr;
_RecordsetPtr rs;
//try{
connstr.CreateInstance(_uuidof(Connection));
rs.CreateInstance(_uuidof(Recordset));
connstr->ConnectionString = "File Name=E:\\moblenet\\Ts.UDL";
connstr->Open("","","",NULL);////这句这什么老出错??
CString SQL="select * from sys_member";
BSTR BSTRSQL=SQL.AllocSysString();
rs->Open(BSTRSQL,(IDispatch*)connstr,adOpenDynamic,adLockOptimistic,0);
while (!rs->adoEOF){
_variant_t TheValue;
TheValue = rs->GetCollect("UserName");
CString StrValue;
TheValue.SetString(StrValue);
//AfxMessageBox(TheValue);
TRACE("字符串值=%s/r",StrValue);
rs->MoveNext();
}
rs->Close();
/*}
catch (_com_error e)
{
AfxMessageBox(e.ErrorMessage());
}*/
rs=NULL;
connstr=NULL;
_RecordsetPtr pRs = NULL ;
_RecordsetPtr pRs2 = NULL ;
_CommandPtr comm = NULL ;
_ParameterPtr param =NULL ;
HRESULT hr = S_OK;_bstr_t strCnn("File Name=c:\\db.udl");
pConn.CreateInstance(__uuidof(Connection));
pConn->CursorLocation =adUseClient;
pConn->ConnectionTimeout =60;pConn->Open (_bstr_t(strCnn),_bstr_t(""),_bstr_t(""),adModeUnknown);