日期:2014-05-17 浏览次数:20486 次
_ConnectionPtr pConn(__uuidof(Connection));
_RecordsetPtr pRecord(__uuidof(Recordset));
pConn->ConnectionString="Data Source=BIT-HCI-GZQ;Initial Catalog=user;Integrated Security=True";
pConn->Open("","","",adConnectUnspecified);
pRecord=pConn->Execute("select * from user",NULL,adCmdText);
while(!pRecord->rsEOF)
{
((CListBox *)GetDlgItem(IDC_LIST1))->AddString(
(_bstr_t)(pRecord->GetCollect("id")));
pRecord->MoveNext();
}
pRecord->Close();
pConn->Close();
pRecord.Release();
pConn.Release();