private void button2_Click(object sender, EventArgs e) { if (IsFree()) { try { string filePath = txtPath.Text.Trim();//备份路径 string backup = @"backup database HeatingFS to disk='" + filePath + "/" + txtFileName.Text.Trim() + @".bak" + " '";//备份数据库语句 if (new SJTD_HDYX.BLL.UserManager().DBBackups(backup)) { DialogResult r = MessageBox.Show("备份成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); if (r == DialogResult.OK) { this.Close(); } } } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } } } private void button3_Click(object sender, EventArgs e) { this.Close(); } private void button1_Click(object sender, EventArgs e) { FolderBrowserDialog FBD = new FolderBrowserDialog(); FBD.SelectedPath = "选择你要存放目录的路径"; if (FBD.ShowDialog() == DialogResult.OK) { txtPath.Text = FBD.SelectedPath; } }