StudentDlg.cpp
上传用户:rs600066
上传日期:2017-10-16
资源大小:4788k
文件大小:17k
源码类别:

数据库系统

开发平台:

Visual C++

  1. // StudentDlg.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "school.h"
  5. #include "StudentDlg.h"
  6. #include "departmentset.h"
  7. #include "majorset.h"
  8. #include "classset.h"
  9. #include "studentInfodlg.h"
  10. #ifdef _DEBUG
  11. #define new DEBUG_NEW
  12. #undef THIS_FILE
  13. static char THIS_FILE[] = __FILE__;
  14. #endif
  15. /////////////////////////////////////////////////////////////////////////////
  16. // CStudentDlg dialog
  17. CStudentDlg::CStudentDlg(CWnd* pParent /*=NULL*/)
  18. : CDialog(CStudentDlg::IDD, pParent)
  19. {
  20. //{{AFX_DATA_INIT(CStudentDlg)
  21. m_strClass = _T("");
  22. m_strDepartment = _T("");
  23. m_strMajor = _T("");
  24. //}}AFX_DATA_INIT
  25. }
  26. void CStudentDlg::DoDataExchange(CDataExchange* pDX)
  27. {
  28. CDialog::DoDataExchange(pDX);
  29. //{{AFX_DATA_MAP(CStudentDlg)
  30. DDX_Control(pDX, IDC_LIST1, m_ctrList);
  31. DDX_Control(pDX, IDC_COMBO_MAJOR, m_ctrMajor);
  32. DDX_Control(pDX, IDC_COMBO_DEPARTMENT, m_ctrDepartment);
  33. DDX_Control(pDX, IDC_COMBO_CLASS, m_ctrClass);
  34. DDX_CBString(pDX, IDC_COMBO_CLASS, m_strClass);
  35. DDX_CBString(pDX, IDC_COMBO_DEPARTMENT, m_strDepartment);
  36. DDX_CBString(pDX, IDC_COMBO_MAJOR, m_strMajor);
  37. //}}AFX_DATA_MAP
  38. }
  39. BEGIN_MESSAGE_MAP(CStudentDlg, CDialog)
  40. //{{AFX_MSG_MAP(CStudentDlg)
  41. ON_NOTIFY(NM_CLICK, IDC_LIST1, OnClickList1)
  42. ON_BN_CLICKED(IDC_BUTTON_NEW, OnButtonNew)
  43. ON_BN_CLICKED(IDC_BUTTON_MODIFY, OnButtonModify)
  44. ON_BN_CLICKED(IDC_BUTTON_DELETE, OnButtonDelete)
  45. ON_BN_CLICKED(IDC_BUTTON_BROWSE, OnButtonBrowse)
  46. ON_CBN_SETFOCUS(IDC_COMBO_MAJOR, OnSetfocusComboMajor)
  47. ON_CBN_SETFOCUS(IDC_COMBO_CLASS, OnSetfocusComboClass)
  48. ON_CBN_SELCHANGE(IDC_COMBO_DEPARTMENT, OnSelchangeComboDepartment)
  49. ON_CBN_SELCHANGE(IDC_COMBO_MAJOR, OnSelchangeComboMajor)
  50. ON_BN_CLICKED(IDC_BUTTON_SEARCH, OnButtonSearch)
  51. //}}AFX_MSG_MAP
  52. END_MESSAGE_MAP()
  53. /////////////////////////////////////////////////////////////////////////////
  54. // CStudentDlg message handlers
  55. BOOL CStudentDlg::OnInitDialog() 
  56. {
  57. CDialog::OnInitDialog();
  58. CDepartmentSet DeptSet ;
  59. CString strSQL;
  60. strSQL="select * from department";
  61. if(!DeptSet.Open(AFX_DB_USE_DEFAULT_TYPE,strSQL))
  62. {
  63. MessageBox("打开数据库失败!","数据库错误",MB_OK);
  64. }
  65. while(!DeptSet.IsEOF())
  66. {
  67. m_ctrDepartment.AddString(DeptSet.m_name);
  68. DeptSet.MoveNext();
  69. }
  70. DeptSet.Close();
  71. m_ctrList.InsertColumn(0,"学号");
  72. m_ctrList.InsertColumn(1,"姓名");
  73. m_ctrList.InsertColumn(2,"曾用名");
  74. m_ctrList.InsertColumn(3,"性别");
  75. m_ctrList.InsertColumn(4,"出生年月");
  76. m_ctrList.InsertColumn(5,"民族");
  77. m_ctrList.InsertColumn(6,"政治面貌");
  78. m_ctrList.InsertColumn(7,"籍贯");
  79. m_ctrList.InsertColumn(8,"家庭出身");
  80. m_ctrList.InsertColumn(9,"联系电话");
  81. m_ctrList.InsertColumn(10,"邮政编码");
  82. m_ctrList.InsertColumn(11,"家庭地址");
  83. m_ctrList.InsertColumn(12,"身份证号");
  84. m_ctrList.InsertColumn(13,"入学时间");
  85. m_ctrList.InsertColumn(14,"毕业时间");
  86. m_ctrList.InsertColumn(15,"班级");
  87. m_ctrList.InsertColumn(16,"所在院系");
  88. m_ctrList.InsertColumn(17,"专业");
  89. m_ctrList.SetColumnWidth(0,60);
  90. m_ctrList.SetColumnWidth(1,80);
  91. m_ctrList.SetColumnWidth(2,80);
  92. m_ctrList.SetColumnWidth(3,60);
  93. m_ctrList.SetColumnWidth(4,60);
  94. m_ctrList.SetColumnWidth(5,60);
  95. m_ctrList.SetColumnWidth(6,100);
  96. m_ctrList.SetColumnWidth(7,60);
  97. m_ctrList.SetColumnWidth(8,100);
  98. m_ctrList.SetColumnWidth(9,100);
  99. m_ctrList.SetColumnWidth(10,100);
  100. m_ctrList.SetColumnWidth(11,100);
  101. m_ctrList.SetColumnWidth(12,100);
  102. m_ctrList.SetColumnWidth(13,100);
  103. m_ctrList.SetColumnWidth(14,100);
  104. m_ctrList.SetColumnWidth(15,100);
  105. m_ctrList.SetColumnWidth(16,100);
  106. m_ctrList.SetColumnWidth(17,100);
  107. m_ctrList.SetExtendedStyle(LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES);
  108. return TRUE;  // return TRUE unless you set the focus to a control
  109.               // EXCEPTION: OCX Property Pages should return FALSE
  110. }
  111. void CStudentDlg::OnClickList1(NMHDR* pNMHDR, LRESULT* pResult) 
  112. {
  113. // TODO: Add your control notification handler code here
  114. *pResult = 0;
  115. }
  116. void CStudentDlg::OnButtonNew() 
  117. {
  118. // TODO: Add your control notification handler code here
  119. CStudentInfoDlg Dlg;
  120. if(IDOK==Dlg.DoModal())
  121. {//添加新记录
  122. if(!m_recordset.Open(AFX_DB_USE_DEFAULT_TYPE))
  123. {
  124. AfxMessageBox("打开数据库失败!");
  125. return ;
  126. }
  127. m_recordset.AddNew();
  128. m_recordset.m_class =Dlg.m_strClass ;
  129. m_recordset.m_department =Dlg.m_strDept ;
  130. m_recordset.m_sex =Dlg.m_strSex ;
  131. m_recordset.m_major =Dlg.m_strMajor ;
  132. m_recordset.m_birthday =Dlg.m_tmBirth ;
  133. m_recordset.m_enroll_date =Dlg.m_tmEnroll ;
  134. m_recordset.m_graduate_date =Dlg.m_tmGraduate ;
  135. m_recordset.m_address =Dlg.m_strAddress ;
  136. m_recordset.m_family_dept1 =Dlg.m_strDept1 ;
  137. m_recordset.m_family_dept2 =Dlg.m_strDept2 ;
  138. m_recordset.m_family_dept3 =Dlg.m_strDept3 ;
  139. m_recordset.m_family_duty1 =Dlg.m_strDuty1 ;
  140. m_recordset.m_family_duty2 =Dlg.m_strDuty2 ;
  141. m_recordset.m_family_dept3 =Dlg.m_strDuty3 ;
  142. m_recordset.m_edu_sys =Dlg.m_strEdusys ;
  143. m_recordset.m_family =Dlg.m_strFamily ;
  144. m_recordset.m_folk =Dlg.m_strFolk ;
  145. m_recordset.m_IDCard =Dlg.m_strIDCard ;
  146. m_recordset.m_family_name1 =Dlg.m_strName1 ;
  147. m_recordset.m_family_name2 =Dlg.m_strName2 ;
  148. m_recordset.m_family_name3 =Dlg.m_strName3 ;
  149. m_recordset.m_native =Dlg.m_strNative ;
  150. m_recordset.m_oldname =Dlg.m_strOldName ;
  151. m_recordset.m_phone =Dlg.m_strPhone ;
  152. m_recordset.m_honor_digiest1 =Dlg.m_strDegist1 ;
  153. m_recordset.m_honor_digiest2 =Dlg.m_strDegist2 ;
  154. m_recordset.m_honor_digiest3 =Dlg.m_strDegist3 ;
  155. m_recordset.m_honor_digiest4 =Dlg.m_strDegist4 ;
  156. m_recordset.m_honor_digiest5 =Dlg.m_strDegist5 ;
  157. m_recordset.m_honor_digiest6 =Dlg.m_strDegist6 ;
  158. m_recordset.m_honor_date1 =Dlg.m_strHonorDate1 ;
  159. m_recordset.m_honor_date2 =Dlg.m_strHonorDate2 ;
  160. m_recordset.m_honor_date3 =Dlg.m_strHonorDate3 ;
  161. m_recordset.m_honor_date4 =Dlg.m_strHonorDate4 ;
  162. m_recordset.m_honor_date5 =Dlg.m_strHonorDate5 ;
  163. m_recordset.m_honor_date6 =Dlg.m_strHonorDate6 ;
  164. m_recordset.m_family_phone1 =Dlg.m_strPhone1 ;
  165. m_recordset.m_family_phone2 =Dlg.m_strPhone2 ;
  166. m_recordset.m_family_phone3 =Dlg.m_strPhone3 ;
  167. m_recordset.m_political =Dlg.m_strPolitical ;
  168. m_recordset.m_family_political1 =Dlg.m_strPolitical1 ;
  169. m_recordset.m_family_political2 =Dlg.m_strPolitical3 ;
  170. m_recordset.m_family_political3 =Dlg.m_strPolitical2 ;
  171. m_recordset.m_postcode =Dlg.m_strPostCode ;
  172. m_recordset.m_family_relation1 =Dlg.m_strRelation1 ;
  173. m_recordset.m_family_relation2 =Dlg.m_strRelation2 ;
  174. m_recordset.m_family_relation3 =Dlg.m_strRelation3 ;
  175. m_recordset.m_honor_remark1 =Dlg.m_strRemark1 ;
  176. m_recordset.m_honor_remark2 =Dlg.m_strRemark2 ;
  177. m_recordset.m_honor_remark3 =Dlg.m_strRemark3 ;
  178. m_recordset.m_honor_remark4 =Dlg.m_strRemark4 ;
  179. m_recordset.m_honor_remark5 =Dlg.m_strRemark5 ;
  180. m_recordset.m_honor_remark6 =Dlg.m_strRemark6 ;
  181. m_recordset.m_term1 =Dlg.m_strScore1 ;
  182. m_recordset.m_term10 =Dlg.m_strScore10 ;
  183. m_recordset.m_term2 =Dlg.m_strScore2 ;
  184. m_recordset.m_term3 =Dlg.m_strScore3 ;
  185. m_recordset.m_term4 =Dlg.m_strScore4 ;
  186. m_recordset.m_term5 =Dlg.m_strScore5 ;
  187. m_recordset.m_term6 =Dlg.m_strScore6 ;
  188. m_recordset.m_term7 =Dlg.m_strScore7 ;
  189. m_recordset.m_term8 =Dlg.m_strScore8 ;
  190. m_recordset.m_term9 =Dlg.m_strScore9 ;
  191. m_recordset.m_code =Dlg.m_strCode ;
  192. m_recordset.m_name =Dlg.m_strName ;
  193. m_recordset.Update();
  194. m_recordset.Close();
  195. CString strSQL = "select * from student ";
  196. RefreshData(strSQL);
  197. }
  198. }
  199. void CStudentDlg::OnButtonModify() 
  200. {
  201. // TODO: Add your control notification handler code here
  202. CStudentInfoDlg Dlg;
  203. UpdateData();
  204. int i = m_ctrList.GetSelectionMark();
  205. if(0>i)
  206. {
  207. AfxMessageBox("请选择一条记录进行修改!");
  208. return;
  209. }
  210. Dlg.m_strCode=m_ctrList.GetItemText(i,0);
  211. if(IDOK==Dlg.DoModal())
  212. {//修改记录
  213. CString strSQL;
  214. strSQL.Format("select * from student where code = '%s'",Dlg.m_strCode);
  215. if(!m_recordset.Open(AFX_DB_USE_DEFAULT_TYPE,strSQL))
  216. {
  217. AfxMessageBox("打开数据库失败!");
  218. return ;
  219. }
  220. m_recordset.Edit();
  221. m_recordset.m_class =Dlg.m_strClass ;
  222. m_recordset.m_department =Dlg.m_strDept ;
  223. m_recordset.m_sex =Dlg.m_strSex ;
  224. m_recordset.m_major =Dlg.m_strMajor ;
  225. m_recordset.m_birthday =Dlg.m_tmBirth ;
  226. m_recordset.m_enroll_date =Dlg.m_tmEnroll ;
  227. m_recordset.m_graduate_date =Dlg.m_tmGraduate ;
  228. m_recordset.m_address =Dlg.m_strAddress ;
  229. m_recordset.m_family_dept1 =Dlg.m_strDept1 ;
  230. m_recordset.m_family_dept2 =Dlg.m_strDept2 ;
  231. m_recordset.m_family_dept3 =Dlg.m_strDept3 ;
  232. m_recordset.m_family_duty1 =Dlg.m_strDuty1 ;
  233. m_recordset.m_family_duty2 =Dlg.m_strDuty2 ;
  234. m_recordset.m_family_dept3 =Dlg.m_strDuty3 ;
  235. m_recordset.m_edu_sys =Dlg.m_strEdusys ;
  236. m_recordset.m_family =Dlg.m_strFamily ;
  237. m_recordset.m_folk =Dlg.m_strFolk ;
  238. m_recordset.m_IDCard =Dlg.m_strIDCard ;
  239. m_recordset.m_family_name1 =Dlg.m_strName1 ;
  240. m_recordset.m_family_name2 =Dlg.m_strName2 ;
  241. m_recordset.m_family_name3 =Dlg.m_strName3 ;
  242. m_recordset.m_native =Dlg.m_strNative ;
  243. m_recordset.m_oldname =Dlg.m_strOldName ;
  244. m_recordset.m_phone =Dlg.m_strPhone ;
  245. m_recordset.m_honor_digiest1 =Dlg.m_strDegist1 ;
  246. m_recordset.m_honor_digiest2 =Dlg.m_strDegist2 ;
  247. m_recordset.m_honor_digiest3 =Dlg.m_strDegist3 ;
  248. m_recordset.m_honor_digiest4 =Dlg.m_strDegist4 ;
  249. m_recordset.m_honor_digiest5 =Dlg.m_strDegist5 ;
  250. m_recordset.m_honor_digiest6 =Dlg.m_strDegist6 ;
  251. m_recordset.m_honor_date1 =Dlg.m_strHonorDate1 ;
  252. m_recordset.m_honor_date2 =Dlg.m_strHonorDate2 ;
  253. m_recordset.m_honor_date3 =Dlg.m_strHonorDate3 ;
  254. m_recordset.m_honor_date4 =Dlg.m_strHonorDate4 ;
  255. m_recordset.m_honor_date5 =Dlg.m_strHonorDate5 ;
  256. m_recordset.m_honor_date6 =Dlg.m_strHonorDate6 ;
  257. m_recordset.m_family_phone1 =Dlg.m_strPhone1  ;
  258. m_recordset.m_family_phone2 =Dlg.m_strPhone2  ;
  259. m_recordset.m_family_phone3 =Dlg.m_strPhone3  ;
  260. m_recordset.m_political =Dlg.m_strPolitical  ;
  261. m_recordset.m_family_political1 =Dlg.m_strPolitical1 ;
  262. m_recordset.m_family_political2 =Dlg.m_strPolitical3 ;
  263. m_recordset.m_family_political3 =Dlg.m_strPolitical2 ;
  264. m_recordset.m_postcode =Dlg.m_strPostCode  ;
  265. m_recordset.m_family_relation1 =Dlg.m_strRelation1  ;
  266. m_recordset.m_family_relation2 =Dlg.m_strRelation2  ;
  267. m_recordset.m_family_relation3 =Dlg.m_strRelation3  ;
  268. m_recordset.m_honor_remark1 =Dlg.m_strRemark1  ;
  269. m_recordset.m_honor_remark2 =Dlg.m_strRemark2  ;
  270. m_recordset.m_honor_remark3 =Dlg.m_strRemark3  ;
  271. m_recordset.m_honor_remark4 =Dlg.m_strRemark4  ;
  272. m_recordset.m_honor_remark5 =Dlg.m_strRemark5  ;
  273. m_recordset.m_honor_remark6 =Dlg.m_strRemark6  ;
  274. m_recordset.m_term1 =Dlg.m_strScore1  ;
  275. m_recordset.m_term10 =Dlg.m_strScore10  ;
  276. m_recordset.m_term2 =Dlg.m_strScore2 ;
  277. m_recordset.m_term3 =Dlg.m_strScore3 ;
  278. m_recordset.m_term4 =Dlg.m_strScore4 ;
  279. m_recordset.m_term5 =Dlg.m_strScore5 ;
  280. m_recordset.m_term6 =Dlg.m_strScore6 ;
  281. m_recordset.m_term7 =Dlg.m_strScore7 ;
  282. m_recordset.m_term8 =Dlg.m_strScore8 ;
  283. m_recordset.m_term9 =Dlg.m_strScore9 ;
  284. m_recordset.m_code =Dlg.m_strCode ;
  285. m_recordset.m_name =Dlg.m_strName ;
  286. m_recordset.Update();
  287. m_recordset.Close();
  288. strSQL = "select * from student ";
  289. RefreshData(strSQL);
  290. }
  291. }
  292. void CStudentDlg::OnButtonDelete() 
  293. {
  294. // TODO: Add your control notification handler code here
  295. int i = m_ctrList.GetSelectionMark();
  296. if(0>i)
  297. {
  298. AfxMessageBox("请选择一条记录进行查看!");
  299. return;
  300. }
  301. CString strSQL;
  302. strSQL.Format("select * from student where code = '%s'",m_ctrList.GetItemText(i,0));
  303. if(!m_recordset.Open(AFX_DB_USE_DEFAULT_TYPE,strSQL))
  304. {
  305. AfxMessageBox("打开数据库失败!");
  306. return ;
  307. }
  308. m_recordset.Delete();
  309. m_recordset.Close();
  310. strSQL = "select * from student";
  311. RefreshData(strSQL);
  312. }
  313. void CStudentDlg::OnButtonBrowse() 
  314. {
  315. // TODO: Add your control notification handler code here
  316. CStudentInfoDlg Dlg;
  317. UpdateData();
  318. int i = m_ctrList.GetSelectionMark();
  319. if(0>i)
  320. {
  321. AfxMessageBox("请选择一条记录进行查看!");
  322. return;
  323. }
  324. Dlg.m_strCode=m_ctrList.GetItemText(i,0);
  325. Dlg.DoModal();
  326. }
  327. void CStudentDlg::OnSetfocusComboMajor() 
  328. {
  329. // TODO: Add your control notification handler code here
  330. UpdateData();
  331. CString strSQL;
  332. //清空ComboBox查询内容//////////////////////
  333. int nCount=m_ctrMajor.GetCount();
  334. for(int i=0;i<nCount;i++)
  335. {
  336. m_ctrMajor.DeleteString(0);
  337. }
  338. nCount=m_ctrClass.GetCount();
  339. for(i=0;i<nCount;i++)
  340. {
  341. m_ctrClass.DeleteString(0);
  342. }
  343. ///////////////////////////////////////////
  344. CMajorSet recordset ;
  345. strSQL.Format( "select * from major where department = '%s'",m_strDepartment);
  346. if(!recordset.Open(AFX_DB_USE_DEFAULT_TYPE,strSQL))
  347. {
  348. MessageBox("打开数据库失败!","数据库错误",MB_OK);
  349. return ;
  350. }
  351. while(!recordset.IsEOF())
  352. {
  353. m_ctrMajor.AddString(recordset.m_name);
  354. recordset.MoveNext();
  355. }
  356. recordset.Close();
  357. }
  358. void CStudentDlg::OnSetfocusComboClass() 
  359. {
  360. // TODO: Add your control notification handler code here
  361. UpdateData();
  362. CString strSQL;
  363. //清空ComboBox查询内容//////////////////////
  364. int nCount=m_ctrClass.GetCount();
  365. for(int i=0;i<nCount;i++)
  366. {
  367. m_ctrClass.DeleteString(0);
  368. }
  369. ///////////////////////////////////////////
  370. CClassSet recordset ;
  371. strSQL.Format( "select * from class where department = '%s' and major = '%s'",m_strDepartment,m_strMajor);
  372. if(!recordset.Open(AFX_DB_USE_DEFAULT_TYPE,strSQL))
  373. {
  374. MessageBox("打开数据库失败!","数据库错误",MB_OK);
  375. return ;
  376. }
  377. while(!recordset.IsEOF())
  378. {
  379. m_ctrClass.AddString(recordset.m_name);
  380. recordset.MoveNext();
  381. }
  382. recordset.Close();
  383. }
  384. void CStudentDlg::OnSelchangeComboDepartment() 
  385. {
  386. // TODO: Add your control notification handler code here
  387. UpdateData();
  388. //清空ComboBox查询内容//////////////////////
  389. int nCount=m_ctrMajor.GetCount();
  390. for(int i=0;i<nCount;i++)
  391. {
  392. m_ctrMajor.DeleteString(0);
  393. }
  394. nCount=m_ctrClass.GetCount();
  395. for(i=0;i<nCount;i++)
  396. {
  397. m_ctrClass.DeleteString(0);
  398. }
  399. ///////////////////////////////////////////
  400. }
  401. void CStudentDlg::OnSelchangeComboMajor() 
  402. {
  403. // TODO: Add your control notification handler code here
  404. UpdateData();
  405. //清空ComboBox查询内容//////////////////////
  406. int nCount=m_ctrClass.GetCount();
  407. for(int i=0;i<nCount;i++)
  408. {
  409. m_ctrClass.DeleteString(0);
  410. }
  411. ///////////////////////////////////////////
  412. }
  413. void CStudentDlg::OnButtonSearch() 
  414. {
  415. // TODO: Add your control notification handler code here
  416. UpdateData();
  417. CString  strSQL,strTemp;
  418. strTemp="";
  419. BOOL bHaveCon = FALSE;
  420. if(m_strDepartment!="")
  421. {
  422. strSQL.Format("select * from student where department = '%s' ",m_strDepartment);
  423. bHaveCon = TRUE;
  424. }
  425. if(m_strMajor!="")
  426. {
  427. if(bHaveCon)
  428. {
  429. strTemp.Format(" major = '%s' ",m_strMajor);
  430. strSQL=strSQL + " and " + strTemp;
  431. }
  432. else
  433. {
  434. strSQL.Format("select * from student where major = '%s' ",m_strMajor);
  435. }
  436. bHaveCon=TRUE;
  437. }
  438. if(m_strClass!="")
  439. {
  440. if(bHaveCon)
  441. {
  442. strTemp.Format(" class = '%s' ",m_strClass);
  443. strSQL=strSQL + " and " + strTemp;
  444. }
  445. else
  446. {
  447. strSQL.Format("select * from student where class = '%s' ",m_strClass);
  448. }
  449. bHaveCon=TRUE;
  450. }
  451. if(!bHaveCon)
  452. {
  453. strSQL="select * from student";
  454. }
  455. RefreshData(strSQL);
  456. }
  457. void CStudentDlg::RefreshData(CString strSQL)
  458. {
  459. m_ctrList.DeleteAllItems();
  460. m_ctrList.SetRedraw(FALSE);
  461. UpdateData(TRUE);
  462. // strSQL="select * from dept";
  463. if(!m_recordset.Open(AFX_DB_USE_DEFAULT_TYPE,strSQL))
  464. {
  465. MessageBox("打开数据库失败!","数据库错误",MB_OK);
  466. return ;
  467. }
  468. int i=0;
  469. CString strTime;
  470. while(!m_recordset.IsEOF())
  471. {
  472. m_ctrList.InsertItem(i,m_recordset.m_code);
  473. m_ctrList.SetItemText(i,1,m_recordset.m_name);
  474. m_ctrList.SetItemText(i,2,m_recordset.m_oldname);
  475. m_ctrList.SetItemText(i,3,m_recordset.m_sex);
  476. strTime.Format("%d-%d-%d",m_recordset.m_birthday.GetYear(),m_recordset.m_birthday.GetMonth(),m_recordset.m_birthday.GetDay());
  477. m_ctrList.SetItemText(i,4,strTime);
  478. m_ctrList.SetItemText(i,5,m_recordset.m_folk);
  479. m_ctrList.SetItemText(i,6,m_recordset.m_political);
  480. m_ctrList.SetItemText(i,7,m_recordset.m_native);
  481. m_ctrList.SetItemText(i,8,m_recordset.m_family);
  482. m_ctrList.SetItemText(i,9,m_recordset.m_phone);
  483. m_ctrList.SetItemText(i,10,m_recordset.m_postcode);
  484. m_ctrList.SetItemText(i,11,m_recordset.m_address);
  485. m_ctrList.SetItemText(i,12,m_recordset.m_IDCard);
  486. strTime.Format("%d-%d-%d",m_recordset.m_enroll_date.GetYear(),m_recordset.m_enroll_date.GetMonth(),m_recordset.m_enroll_date.GetDay());
  487. m_ctrList.SetItemText(i,13,strTime);
  488. strTime.Format("%d-%d-%d",m_recordset.m_graduate_date.GetYear(),m_recordset.m_graduate_date.GetMonth(),m_recordset.m_graduate_date.GetDay());
  489. m_ctrList.SetItemText(i,14,strTime);
  490. m_ctrList.SetItemText(i,15,m_recordset.m_class);
  491. m_ctrList.SetItemText(i,16,m_recordset.m_department);
  492. m_ctrList.SetItemText(i,17,m_recordset.m_major);
  493. i++;
  494. m_recordset.MoveNext();
  495. }
  496. m_recordset.Close();
  497. m_ctrList.SetRedraw(TRUE);
  498. }