MFC学习第八节:在数据库的数据在窗口中显示(显示多个学生时)

接第七节内容
 1.在student.h中加头文件#include<afxdb.h>;
 2.在view.cpp中加头文件#include“student.h“;
 3.创建OnRButtonDown函数;
 4.改变OnLButtonDown函数中的固定显示坐标即可;
void CDdView::OnRButtonDown(UINT nFlags, CPoint point) 
{
	// TODO: Add your message handler code here and/or call default
					

         CStudent rs;
	int y=20;
         CClientDC dc(this);
	rs.Open();
         CString strTemp;

	while(!rs.IsEOF())
	{
	 
	
		strTemp.Format("id:%s,name:%s,english:%d",rs.m_ID,rs.m_name,rs.m_english);
	         rs.MoveNext();
		dc.TextOut(20,y,strTemp);
		y+=20;
	}
       
	
	CView::OnRButtonDown(nFlags, point);
}

猜你喜欢

转载自blog.csdn.net/u010256329/article/details/9417457