初始化ListControl控件问题
voidCdblink3Dlg::AddToGrid(){adoconnm_AdoConn;m_AdoConn.OnInitADOConn();CStringsql;sq...
void Cdblink3Dlg::AddToGrid()
{
adoconn m_AdoConn;
m_AdoConn.OnInitADOConn();
CString sql;
sql.Format("select* from student order by 编号 desc");
_RecordsetPtr m_pRecordset;
m_pRecordset=m_AdoConn.GetRecordSet((_bstr_t)sql);
while(m_AdoConn.m_pRecordset->adoEOF==0)
{
m_Grid.InsertItem(0,"");
m_Grid.SetItemText(0,0,(char*)(_bstr_t)m_pRecordset->GetCollect("ID"));
m_Grid.SetItemText(0,1,(char*)(_bstr_t)m_pRecordset->GetCollect("NAME"));
//m_Grid.SetItemText(0,2,(char*)(_bstr_t)m_pRecordset->GetCollect("性别"));
m_Grid.SetItemText(0,2,(char*)(_bstr_t)m_pRecordset->GetCollect("NUMBER"));
m_pRecordset->MoveNext();
}
m_AdoConn.ExitConnect();
}
发生错误:
:InsertColumn(int,LPCTSTR,int,int,int)' : cannot convert parameter 2 from 'const char [3]' to 'LPCTSTR'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
e:\virtual studio exersize\dblink3\dblink3\dblink3dlg.cpp(115) : error C2664: 'int CListCtrl::InsertColumn(int,LPCTSTR,int,int,int)' : cannot convert parameter 2 from 'const char [5]' to 'LPCTSTR'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
e:\virtual studio exersize\dblink3\dblink3\dblink3dlg.cpp(117) : error C2664: 'int CListCtrl::InsertColumn(int,LPCTSTR,int,int,int)' : cannot convert parameter 2 from 'const char [7]' to 'LPCTSTR'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
请问高手是怎么回事? 展开
{
adoconn m_AdoConn;
m_AdoConn.OnInitADOConn();
CString sql;
sql.Format("select* from student order by 编号 desc");
_RecordsetPtr m_pRecordset;
m_pRecordset=m_AdoConn.GetRecordSet((_bstr_t)sql);
while(m_AdoConn.m_pRecordset->adoEOF==0)
{
m_Grid.InsertItem(0,"");
m_Grid.SetItemText(0,0,(char*)(_bstr_t)m_pRecordset->GetCollect("ID"));
m_Grid.SetItemText(0,1,(char*)(_bstr_t)m_pRecordset->GetCollect("NAME"));
//m_Grid.SetItemText(0,2,(char*)(_bstr_t)m_pRecordset->GetCollect("性别"));
m_Grid.SetItemText(0,2,(char*)(_bstr_t)m_pRecordset->GetCollect("NUMBER"));
m_pRecordset->MoveNext();
}
m_AdoConn.ExitConnect();
}
发生错误:
:InsertColumn(int,LPCTSTR,int,int,int)' : cannot convert parameter 2 from 'const char [3]' to 'LPCTSTR'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
e:\virtual studio exersize\dblink3\dblink3\dblink3dlg.cpp(115) : error C2664: 'int CListCtrl::InsertColumn(int,LPCTSTR,int,int,int)' : cannot convert parameter 2 from 'const char [5]' to 'LPCTSTR'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
e:\virtual studio exersize\dblink3\dblink3\dblink3dlg.cpp(117) : error C2664: 'int CListCtrl::InsertColumn(int,LPCTSTR,int,int,int)' : cannot convert parameter 2 from 'const char [7]' to 'LPCTSTR'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
请问高手是怎么回事? 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询