首页上一页 1 下一页尾页 1 条记录 1/1页
VC++碰到一个问题,谁能帮忙下啊
发表在C语言图书答疑
2012-10-08
是否精华
是
否
版块置顶:
是
否
m_list_jh.SetExtendedStyle(LVS_EX_FLATSB
|LVS_EX_FULLROWSELECT
|LVS_EX_HEADERDRAGDROP
|LVS_EX_ONECLICKACTIVATE
|LVS_EX_GRIDLINES);
m_list_jh.InsertColumn(0,"编号",LVCFMT_LEFT,110,0);
m_list_jh.InsertColumn(1,"姓名",LVCFMT_LEFT,110,1);
m_list_jh.InsertColumn(2,"性别",LVCFMT_LEFT,110,2);
m_list_jh.InsertColumn(3,"学历",LVCFMT_LEFT,110,3);
try
{
//创建连接对象实例
m_pConnection.CreateInstance("ADODB.Connection");
//设置连接字符串
CString strConnect="DRIVER={Microsoft Access Driver (*.mdb)};\
uid=;pwd=;DBQ=jx.mdb;";
//使用Open方法连接数据库
m_pConnection->Open((_bstr_t)strConnect,"","",adModeUnknown);
}
catch(_com_error e)
{
AfxMessageBox(e.Description());
}
//设置查询字符串
_bstr_t bstrSQL = "select * from employees order by 编号 desc";
//创建记录集指针对象实例
m_pRecordset.CreateInstance(__uuidof(Recordset));
//打开记录集
m_col->Open(bstrSQL,m_pConnection.GetInterfacePtr(),adOpenDynamic,
adLockOptimistic,adCmdText);
while(!m_col->adoEOF)
{
m_list_jh.InsertItem(0,"");
m_list_jh.SetItemText(0,0,(char*)(_bstr_t)m_col->GetCollect("编号"));
m_list_jh.SetItemText(0,1,(char*)(_bstr_t)m_col->GetCollect("姓名"));
m_list_jh.SetItemText(0,2,(char*)(_bstr_t)m_col->GetCollect("性别"));
m_list_jh.SetItemText(0,3,(char*)(_bstr_t)m_col->GetCollect("学历"));
//将记录集指针移动到下一条记录
m_pRecordset->MoveNext();
}
m_col->Close();
m_pConnection->Close();
return TRUE; // return TRUE unless you set the focus to a control
能帮我解答下,为什么我复制过来是错的
m_pConnection是什么,需要怎么申明
|LVS_EX_FULLROWSELECT
|LVS_EX_HEADERDRAGDROP
|LVS_EX_ONECLICKACTIVATE
|LVS_EX_GRIDLINES);
m_list_jh.InsertColumn(0,"编号",LVCFMT_LEFT,110,0);
m_list_jh.InsertColumn(1,"姓名",LVCFMT_LEFT,110,1);
m_list_jh.InsertColumn(2,"性别",LVCFMT_LEFT,110,2);
m_list_jh.InsertColumn(3,"学历",LVCFMT_LEFT,110,3);
try
{
//创建连接对象实例
m_pConnection.CreateInstance("ADODB.Connection");
//设置连接字符串
CString strConnect="DRIVER={Microsoft Access Driver (*.mdb)};\
uid=;pwd=;DBQ=jx.mdb;";
//使用Open方法连接数据库
m_pConnection->Open((_bstr_t)strConnect,"","",adModeUnknown);
}
catch(_com_error e)
{
AfxMessageBox(e.Description());
}
//设置查询字符串
_bstr_t bstrSQL = "select * from employees order by 编号 desc";
//创建记录集指针对象实例
m_pRecordset.CreateInstance(__uuidof(Recordset));
//打开记录集
m_col->Open(bstrSQL,m_pConnection.GetInterfacePtr(),adOpenDynamic,
adLockOptimistic,adCmdText);
while(!m_col->adoEOF)
{
m_list_jh.InsertItem(0,"");
m_list_jh.SetItemText(0,0,(char*)(_bstr_t)m_col->GetCollect("编号"));
m_list_jh.SetItemText(0,1,(char*)(_bstr_t)m_col->GetCollect("姓名"));
m_list_jh.SetItemText(0,2,(char*)(_bstr_t)m_col->GetCollect("性别"));
m_list_jh.SetItemText(0,3,(char*)(_bstr_t)m_col->GetCollect("学历"));
//将记录集指针移动到下一条记录
m_pRecordset->MoveNext();
}
m_col->Close();
m_pConnection->Close();
return TRUE; // return TRUE unless you set the focus to a control
能帮我解答下,为什么我复制过来是错的
m_pConnection是什么,需要怎么申明