backuprestoredb.cpp
来自「员工管理系统,基本的数据库操作,数据库类的设计,基本的查询等」· C++ 代码 · 共 106 行
CPP
106 行
// BackupRestoreDB.cpp : implementation file
//
#include "stdafx.h"
#include "数据库.h"
#include "BackupRestoreDB.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CBackupRestoreDB dialog
CBackupRestoreDB::CBackupRestoreDB(CWnd* pParent /*=NULL*/)
: CDialog(CBackupRestoreDB::IDD, pParent)
{
//{{AFX_DATA_INIT(CBackupRestoreDB)
m_pathname = _T("");
//}}AFX_DATA_INIT
m_bBackup = true;
}
void CBackupRestoreDB::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CBackupRestoreDB)
DDX_Text(pDX, IDC_Pathname, m_pathname);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CBackupRestoreDB, CDialog)
//{{AFX_MSG_MAP(CBackupRestoreDB)
ON_BN_CLICKED(IDC_FileName, OnFileName)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CBackupRestoreDB message handlers
void CBackupRestoreDB::OnFileName()
{
// TODO: Add your control notification handler code here
BOOL bDialogKind;
bDialogKind = !m_bBackup;
CFileDialog dlg(bDialogKind, NULL, "songdb.bak",
OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
"备份文件(*.bak)|*.bak||");
if(dlg.DoModal() == IDOK)
{
UpdateData();
m_pathname = dlg.GetPathName();
UpdateData(false);
}
}
void CBackupRestoreDB::OnOK()
{
// TODO: Add extra validation here
UpdateData(true);
CDialog::OnOK();
}
CString CBackupRestoreDB::GetPathname()
{
return m_pathname;
}
CString CBackupRestoreDB::GetDatabasename()
{
CString str;
str.Format("xu");
return str;
}
void CBackupRestoreDB::SetDialogFlag(BOOL bBackup)
{
m_bBackup = bBackup;
}
BOOL CBackupRestoreDB::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
if( m_bBackup )
SetWindowText("备份数据库");
else
{
SetWindowText("恢复数据库");
CButton* bt;
bt = (CButton*) GetDlgItem(IDOK);
bt->SetDlgItemText(IDOK,"恢复数据库");
}
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 + =
减小字号Ctrl + -
显示快捷键?