第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

MFC用ado方法和數(shù)據(jù)庫連接后,怎么取得數(shù)據(jù)

MFC用ado方法和數(shù)據(jù)庫連接后,怎么取得數(shù)據(jù)

慕桂英3389331 2019-05-13 16:08:47
MFC用ado方法和數(shù)據(jù)庫連接后,怎么取得數(shù)據(jù)
查看完整描述

2 回答

?
MMTTMM

TA貢獻1869條經(jīng)驗 獲得超4個贊

pCommand->CommandText = "SELECT * FROM XXX";
pRecordset=pCommand->Execute(NULL,NULL,adCmdText);
這就會執(zhí)行那句select語句。
至于你說的放哪,就又你自己決定,我猜你是想放列表控件里面。這樣的話 你就直接顯示在列表控件中就是了。
代碼如下:
int cols = pRecordset->GetFields()->Count;//獲取列數(shù)
if (data_name!=NULL)
{
delete []data_name;
}
data_name = new CString[cols];
_variant_t get_name;
//讀取字段名
for (int i=0;i<cols;i++)
{
get_name = pRecordset->GetFields()->GetItem(_variant_t(short(i)))->GetName();
if (get_name.vt==VT_NULL)
{
data_name[i].Empty();
}
else
data_name[i] = (LPCTSTR)(_bstr_t)get_name;
int nWidth = listctrl.GetStringWidth(data_name[i]) + 60;
listctrl.InsertColumn(i, data_name[i], LVCFMT_LEFT, nWidth);
}
int nCount =0;
//獲取數(shù)據(jù)
CString lptext;
bool f =false;
CString k("0");
while (!pRecordset->GetadoEOF ())
{
listctrl.InsertItem(nCount,k);
for (int j=0;j<cols;j++)
{
get_name = pRecordset->GetFields()->GetItem(_variant_t(short(j)))->GetValue();
if (get_name.vt==VT_NULL)
{
lptext.Empty();
}
else
lptext = (LPCTSTR)(_bstr_t)get_name;

listctrl.SetItemText(nCount,j,lptext);
}
pRecordset->MoveNext();
nCount++;
}
pRecordset->Close();

 




查看完整回答
反對 回復(fù) 2019-05-14
  • 2 回答
  • 0 關(guān)注
  • 477 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號