Home > Software engineering >  CListCtrl class connect to the database InsertItem field problem with serial number
CListCtrl class connect to the database InsertItem field problem with serial number

Time:09-16

The database with the increasing number of Sn,
Vc + + the odbc data source connection operation data, shows a database in vc interface ClistCtrl controls all the columns, but the serial number column does not display all the time,
M_StudentID shows the serial number of the data, m_StuName shows m_StudentID data and so on, are behind a column shows, make the back of the m_StuAge
Field shows the m_StuSex, an int type, a type varchar, conflict
In front of a column of data, can you tell me the barons to keep their identity?
The code is as follows:
CListCtrl m_listStuInfo;
for (int i=0; ! StuInfoSet. IsEOF (); I++)
{
StrID. The Format (" % d ", stuInfoSet. M_sn);
M_listStuInfo. InsertItem (I, stuInfoSet. M_sn);
//m_listStuInfo InsertItem (I, stuInfoSet m_StudentID);
M_listStuInfo. SetItemText (I, 1, stuInfoSet m_StudentID);
M_listStuInfo. SetItemText (I, 2, stuInfoSet m_StuName);
M_listStuInfo. SetItemText (I, 3, stuInfoSet m_StuSex);
StrTmp. The Format (" % d ", stuInfoSet. M_StuAge);
M_listStuInfo. SetItemText (I, 4, strTmp);
M_listStuInfo. SetItemText (I, 5, stuInfoSet m_StuDept);
StuInfoSet. MoveNext ();
}

CodePudding user response:

What is conflict? Display is not normal?

CodePudding user response:

Misplaced misplaced, debugging, m_sn does not display, m_StudentID shows that the first field variables, and so on,

CodePudding user response:

CListCtrl m_listStuInfo;
for (int i=0; ! StuInfoSet. IsEOF (); I++)
{
StrID. The Format (" % d ", stuInfoSet. M_sn);
M_listStuInfo. InsertItem (I, strID);


M_listStuInfo. SetItemText (I, 1, stuInfoSet m_StuName);
M_listStuInfo. SetItemText (I, 2, stuInfoSet m_StuSex);
StrTmp. The Format (" % d ", stuInfoSet. M_StuAge);
M_listStuInfo. SetItemText (I, 3, strTmp);
M_listStuInfo. SetItemText (I, 4, stuInfoSet m_StuDept);

StuInfoSet. MoveNext ();
}
  • Related