//数据备份菜单点击事件
private void mnuBackUp_Click(object sender, System.EventArgs e)
{
frmBackUp back=new frmBackUp(frmBackUp.SetType.BackUp);
back.Show();
//调用dll
BackUpAndReinstate.BackUp backup=new BackUpAndReinstate.BackUp(Application.StartupPath+"//BackUp//TeachingBusiness.bak");
string message=backup.DataBaseBackUp();
MessageBox.Show(message,"消息",MessageBoxButtons.OK,MessageBoxIcon.Information);
back.Close();
}
//数据恢复菜单点击事件
private void mnuReinstate_Click(object sender, System.EventArgs e)
{
frmBackUp back=new frmBackUp(frmBackUp.SetType.Reinstate);
back.Show();
//调用dll
BackUpAndReinstate.Reinstate reinstate=new BackUpAndReinstate.Reinstate();
string message=reinstate.DataBaseReinstate();
MessageBox.Show(message,"消息",MessageBoxButtons.OK,MessageBoxIcon.Information);
back.Close();
}
frmBackUp窗体代码:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
namespace 教务系统
{
/// <summary>
/// frmBackUp 的摘要说明。
/// </summary>
public class frmBackUp : System.Windows.Forms.Form
{
private System.Windows.Forms.Label label1;
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.Timer timer1;
private System.ComponentModel.IContainer components;
public enum SetType
{
BackUp,
Reinstate
}
private int type=0;
public frmBackUp(SetType settype)
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
this.type=(int)settype;
//
//
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.compo