Пример #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (Mysqlcom.Myopen())
                return;

            DBbackup dbb = new DBbackup();
            label3.Text = "硬盘备份中......";
            Directory.CreateDirectory(textBox1.Text);
            Mysqlcom.cons = false;
            button1.Enabled = false;
            if (dbb.DBtoFile(textBox1.Text, progressBar1))
            {

                if (textBox2.Text != "没有检测到u盘!")
                {
                    try
                    {
                        label3.Text = "U盘备份中......";
                        File.Copy(textBox1.Text + "\\洗衣数据库.sql", textBox2.Text + "洗衣数据库.sql", true);
                        File.Copy(textBox1.Text + "\\main.ini", textBox2.Text + "main.ini", true);
                        File.Copy(textBox1.Text + "\\sqlserver.ini", textBox2.Text + "sqlserver.ini", true);
                    }
                    catch (Exception ce)
                    {

                        MessageBox.Show("u盘备份出错:" + ce.Message, "错误");
                    }
                }
                label3.Text = "备份成功!";
            }
            else
            {
                progressBar1.Value = 0;
                label3.Text = "备份失败!";
            }
            Mysqlcom.cons = true ;
            button1.Enabled = true;
        }
Пример #2
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (textBox2.Text == "没有检测到u盘!") return;
            DBbackup dbb = new DBbackup();

            label3.Text = "U盘备份中...";
            if (dbb.DBtoFile(textBox2.Text, progressBar1))
            {
                label3.Text = "U盘备份成功!";
            }
        }