MFCラーニングセクション8:データベース内のデータがウィンドウに表示されます(複数の学生が表示されている場合)

セクション7に
 進みます。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