Access数据库备份File.Copy()

    技术2022-06-28  46

    private void btnBackup_Click(object sender, EventArgs e) { //string backupName = System.DateTime.Now.ToString("yyyy年MM月dd日"); //string backupName = System.DateTime.Now.ToLongDateString(); string path = "POS.mdb"; string path2 = "DataBackup//" + System.DateTime.Now.ToLongDateString() + ".mdb "; try { FileStream fs = File.Create(path2); fs.Close(); File.Copy(path, path2, true); MessageBox.Show("备份成功!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } catch (Exception ex) { MessageBox.Show(ex.Message, "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }  


    最新回复(0)