private void Exportsjk() { Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); labxx1.Text = "正在备份数据库..."; labxx2.Text = ""; labxx3.Text = ""; Application.DoEvents(); string f = Path.Combine(txtBackPath.Text.Trim(), DateTime.Now.ToString("yyyyMMddhhmm") + ".bak"); string z = Path.Combine(txtBackPath.Text.Trim(), DateTime.Now.ToString("yyyyMMddhhmm") + ".zip"); if (rButBak.Checked) { if (File.Exists(f)) { File.Delete(f); } } T_Sysset.BackSql(f); if (File.Exists(f)) { using (ZipFile zip = ZipFile.Create(z)) { zip.BeginUpdate(); zip.Add(f); zip.Password = "******" + DateTime.Now.ToString("yyyyMMdd"); zip.CommitUpdate(); } } try { if (File.Exists(z)) { File.Delete(f); } } catch { } stopwatch.Stop(); labxx1.Text = "备份完成耗时:" + stopwatch.Elapsed.TotalSeconds; labxx2.Text = "备份完整路径:" + z; }