正文

如何用MsflexGrid网格显示查询数据?2005-07-22 13:20:00

【评论】 【打印】 【字体: 】 本文链接:http://blog.pfan.cn/leafage/3088.html

分享到:

BOOL CLOGINFO::OnInitDialog() { CDialog::OnInitDialog(); // TODO: Add extra initialization here m_mf.SetRows(2); m_mf.SetCols(4); m_mf.SetColWidth(0,800); m_mf.SetColWidth(1,1200); m_mf.SetColWidth(2,1000); m_mf.SetColWidth(3,6000); m_mf.SetTextMatrix(0,1,"日期"); m_mf.SetTextMatrix(0,2,"时间"); m_mf.SetTextMatrix(0,3,"事件"); CString strSql,row; strSql.Insert(0,"select 日期,时间,事件 from slog order by 日期 desc,时间 desc"); _RecordsetPtr pRs; CKaoqinApp* ap=(CKaoqinApp*)AfxGetApp(); ::CoInitialize(NULL); pRs.CreateInstance(__uuidof(Recordset)); pRs->Open(_bstr_t(strSql),ap->m_pCon.GetInterfacePtr(),adOpenKeyset,adLockOptimistic,adCmdText); if(0<pRs->RecordCount) { m_mf.SetRows(pRs->RecordCount+1); } BeginWaitCursor(); try { for(long i=1;i<pRs->RecordCount;i++) { row.Empty(); row.Format("%d",i); m_mf.SetTextMatrix(i,0,row); for(long j=1;j<4;j++) { m_mf.SetTextMatrix(i,j,(char*)_bstr_t(pRs->GetFields()->GetItem(j-1L)->GetValue()));

阅读(4676) | 评论(0)


版权声明:编程爱好者网站为此博客服务提供商,如本文牵涉到版权问题,编程爱好者网站不承担相关责任,如有版权问题请直接与本文作者联系解决。谢谢!

评论

暂无评论
您需要登录后才能评论,请 登录 或者 注册