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;