_RecordsetPtr& CAdoConn::GetRecordSet(_bstr_t bstrSQL)
{
try
{
// 连接数据库,如果Connection对象为空,则重新连接数据库
// if(m_pConnection==NULL)
// OnInitADOConn(); // 创建记录集对象
m_pRecordset.CreateInstance(__uuidof(Recordset));
// 取得表中的记录
m_pRecordset->Open(bstrSQL,m_pConnection.GetInterfacePtr(),adOpenDynamic,adLockOptimistic,adCmdText);
}
catch(_com_error e) // 捕捉异常
{
AfxMessageBox(e.Description());
}
return m_pRecordset; // 返回记录集
}//查询按键设置
void CTestDlg::OnButtonrep()
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);
_bstr_t bstrSQL=" Select xianhao,bianzhanhao,zhanming From 线路 where xianhao='" +m_xianhao+"' and bianzhanhao='" +m_bianzhanhao+ "' ";
m_Ac.GetRecordSet(bstrSQL);
}
之后怎样把记录集显示到CIST BOX里面,不用GetCollect,能用什么函数?
{
try
{
// 连接数据库,如果Connection对象为空,则重新连接数据库
// if(m_pConnection==NULL)
// OnInitADOConn(); // 创建记录集对象
m_pRecordset.CreateInstance(__uuidof(Recordset));
// 取得表中的记录
m_pRecordset->Open(bstrSQL,m_pConnection.GetInterfacePtr(),adOpenDynamic,adLockOptimistic,adCmdText);
}
catch(_com_error e) // 捕捉异常
{
AfxMessageBox(e.Description());
}
return m_pRecordset; // 返回记录集
}//查询按键设置
void CTestDlg::OnButtonrep()
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);
_bstr_t bstrSQL=" Select xianhao,bianzhanhao,zhanming From 线路 where xianhao='" +m_xianhao+"' and bianzhanhao='" +m_bianzhanhao+ "' ";
m_Ac.GetRecordSet(bstrSQL);
}
之后怎样把记录集显示到CIST BOX里面,不用GetCollect,能用什么函数?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货