📄 tongji.cpp
字号:
// Tongji.cpp : implementation file
//
#include "stdafx.h"
#include "物业管理系统.h"
#include "Tongji.h"
#include"Inf.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CTongji dialog
CTongji::CTongji(CWnd* pParent /*=NULL*/)
: CDialog(CTongji::IDD, pParent)
{
//{{AFX_DATA_INIT(CTongji)
m_nmang = _T("");
m_nwater = _T("");
//}}AFX_DATA_INIT
}
void CTongji::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CTongji)
DDX_Text(pDX, IDC_EDIT3, m_nmang);
DDX_Text(pDX, IDC_EDIT4, m_nwater);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CTongji, CDialog)
//{{AFX_MSG_MAP(CTongji)
ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
ON_BN_CLICKED(IDC_BUTTON3, OnButton3)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CTongji message handlers
void CTongji::OnButton1()
{
// TODO: Add your control notification handler code here
CInf recordset;
CString strSQL;
int a=0,b=0;
strSQL.Format("select * from inf");
if(!recordset.Open(AFX_DB_USE_DEFAULT_TYPE,strSQL))
{
MessageBox("打开数据失败!");
}
while(!recordset.IsEOF())
{
a=a+atof(recordset.m_mang);
b=b+atof(recordset.m_water);
recordset.MoveNext();
}
recordset.Close();
CString str1;
CString str2;
str1.Format("%ld元",a);
str2.Format("%ld元",b);
m_nmang=str1;
m_nwater=str2;
UpdateData(FALSE);
}
void CTongji::OnButton3()
{
// TODO: Add your control notification handler code here
CDialog::OnCancel();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -