VS2008编程问题

[复制链接]
查看11 | 回复2 | 2010-1-19 13:34:58 | 显示全部楼层 |阅读模式
字符串里的\换成\\(CListBox*)GetDlgItem(IDC_LIST1)得先判断是否返回空。au_lname没写错?
回复

使用道具 举报

千问 | 2010-1-19 13:34:58 | 显示全部楼层
CoInitialize(NULL); _ConnectionPtr pConn(__uuidof(Connection)); _RecordsetPtr pRst(__uuidof(Recordset)); pConn->ConnectionString="Data Source=SONY-VAIO\\SQLEXPRESS;Integrated Security=True";pConn->Open("","","",adConnectUnspecified); pRst = pConn->Execute("select Sno from Student",NULL,adCmdText); while(!pRst->rsEOF) {((CListBox*)GetDlgItem(IDC_LIST1))->AddString((_bstr_t)pRst->GetCollect("au_lname"));pRst->MoveNext();} pRst->Close(); pConn->Close(); pRst.Release(); pConn.Release(); CoUninitialize();
回复

使用道具 举报

千问 | 2010-1-19 13:34:58 | 显示全部楼层
((_bstr_t)pRst->GetCollect("au_lname"))CString 封装一遍试试
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行