MFC Learning Section 8: The data in the database is displayed in the window (when a student is displayed)

Continue to section 7

1. Add the header file #include<afxdb.h> in student.h;

2. Add the header file #include "student.h" in view.cpp;

3. Create the function OnLButtonDown, and click the left button to display the data.

 CStudent rs;
  
 rs.Open();
 rs.AddNew();
 rs.m_ID= "001" ;
 rs.m_name= "hhs" ;
 rs.m_english=80;
 rs.Update();
      
  
 CString strTemp;
 strTemp.Format( "id:%s,name:%s,english:%d" ,rs.m_ID,rs.m_name,rs.m_english);
 CClientDC dc( this );
 dc.TextOut(20,20,strTemp);
  rs.Close();
 

Guess you like

Origin blog.csdn.net/u010256329/article/details/9412245