⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 renew.cpp

📁 一个简单的银行管理程序 VC++实现
💻 CPP
字号:
// ReNew.cpp : implementation file
//

#include "stdafx.h"
#include "banksystem.h"
#include "ReNew.h"
#include "BankSystemDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CReNew dialog


CReNew::CReNew(CWnd* pParent /*=NULL*/)
	: CDialog(CReNew::IDD, pParent)
{
	//{{AFX_DATA_INIT(CReNew)
	m_fInterest2 = 0.0f;
	m_fInterest1 = 0.0f;
	m_fRatio1 = 0.0f;
	m_fRatio2 = 0.0f;
	//}}AFX_DATA_INIT
}


void CReNew::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CReNew)
	DDX_Text(pDX, IDC_EDIT2, m_fInterest2);
	DDX_Text(pDX, IDC_EDIT1, m_fInterest1);
	DDX_Text(pDX, IDC_EDIT3, m_fRatio1);
	DDX_Text(pDX, IDC_EDIT4, m_fRatio2);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CReNew, CDialog)
	//{{AFX_MSG_MAP(CReNew)
	ON_BN_CLICKED(IDOK, OnReNew)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CReNew message handlers

void CReNew::OnReNew() 
{
	// TODO: Add your control notification handler code here

	UpdateData(true);

	_ConnectionPtr m_pCon;
	_RecordsetPtr  m_pRec;

	CBankSystemApp *App = (CBankSystemApp*)AfxGetApp();
	CBankSystemDlg *m_pMain = (CBankSystemDlg*)App->m_pMainWnd;

	_variant_t  varInterest1,varInterest2,varRatio1,varRatio2,varRatio3;

	m_pCon = m_pMain->m_pConnection;
	m_pRec.CreateInstance(__uuidof(Recordset));
	m_pRec->Open("SELECT * FROM VIEW3",m_pCon.GetInterfacePtr(),adOpenDynamic,adLockOptimistic,adCmdText);
    
	if(m_pRec->adoEOF)
	{
		AfxMessageBox("ERROR!");
		m_pRec->Close();
		return ;
	}

/*	varInterest1 = m_pRec->GetCollect("活期");
	varInterest2 = m_pRec->GetCollect("定期");
	varRatio1    = m_pRec->GetCollect("美元");
	varRatio2    = m_pRec->GetCollect("欧元");
	varRatio3    = m_pRec->GetCollect("人民币");*/

	varInterest1.vt = VT_R4;
	varInterest2.vt = VT_R4;
	varRatio1.vt	= VT_R4;
	varRatio2.vt    = VT_R4;
	varRatio3.vt    = VT_R4;

	varInterest1.fltVal = m_fInterest1; 
	varInterest2.fltVal = m_fInterest2;
	varRatio1.fltVal    = m_fRatio1;
	varRatio2.fltVal    = m_fRatio2;

	m_pRec->PutCollect("活期",varInterest1);
	m_pRec->PutCollect("定期",varInterest2);
	m_pRec->PutCollect("美元",varRatio1);
	m_pRec->PutCollect("欧元",varRatio2);
	m_pRec->PutCollect("人民币",varRatio3);


//	UpdateData(false);

	m_pRec->Update();
	m_pRec->Close();
	
	
}


BOOL CReNew::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	_ConnectionPtr m_pCon;
	_RecordsetPtr  m_pRec;

	CBankSystemApp *App = (CBankSystemApp*)AfxGetApp();
	CBankSystemDlg *m_pMain = (CBankSystemDlg*)App->m_pMainWnd;

	_variant_t  varInterest1,varInterest2,varRatio1,varRatio2;

	m_pCon = m_pMain->m_pConnection;
	m_pRec.CreateInstance(__uuidof(Recordset));
	m_pRec->Open("SELECT * FROM VIEW3",m_pCon.GetInterfacePtr(),adOpenDynamic,adLockOptimistic,adCmdText);
    
	if(m_pRec->adoEOF)
	{
		AfxMessageBox("ERROR!");
		m_pRec->Close();
		return TRUE;
	}

	varInterest1 = m_pRec->GetCollect("活期");
	varInterest2 = m_pRec->GetCollect("定期");
	varRatio1    = m_pRec->GetCollect("美元");
	varRatio2    = m_pRec->GetCollect("欧元");

	m_fInterest1 = varInterest1.dblVal;
	m_fInterest2 = varInterest2.dblVal;
	m_fRatio1    = varRatio1.dblVal;
	m_fRatio2    = varRatio2.dblVal;

	UpdateData(false);

	m_pRec->Close();
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -