惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
The Blog of Author Tim Ferriss
S
Securelist
D
Docker
The Register - Security
The Register - Security
GbyAI
GbyAI
Recorded Future
Recorded Future
Engineering at Meta
Engineering at Meta
Stack Overflow Blog
Stack Overflow Blog
云风的 BLOG
云风的 BLOG
P
Proofpoint News Feed
罗磊的独立博客
博客园 - 【当耐特】
F
Full Disclosure
WordPress大学
WordPress大学
腾讯CDC
小众软件
小众软件
大猫的无限游戏
大猫的无限游戏
D
DataBreaches.Net
SecWiki News
SecWiki News
L
Lohrmann on Cybersecurity
I
InfoQ
MyScale Blog
MyScale Blog
量子位
Cyberwarzone
Cyberwarzone
博客园 - 三生石上(FineUI控件)
The Hacker News
The Hacker News
F
Fortinet All Blogs
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Jina AI
Jina AI
博客园_首页
H
Help Net Security
K
Kaspersky official blog
酷 壳 – CoolShell
酷 壳 – CoolShell
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Webroot Blog
Webroot Blog
Blog — PlanetScale
Blog — PlanetScale
V
Vulnerabilities – Threatpost
Y
Y Combinator Blog
The Cloudflare Blog
P
Proofpoint News Feed
V
Visual Studio Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
T
Tailwind CSS Blog
爱范儿
爱范儿
P
Privacy International News Feed
Security Archives - TechRepublic
Security Archives - TechRepublic
The GitHub Blog
The GitHub Blog
C
Cybersecurity and Infrastructure Security Agency CISA
B
Blog RSS Feed

博客园 - 朱小能

C#对Dictionary的按Value排序 linq to sql中的自动缓存(对象跟踪) javascript 调用webservice 的几种方法 修改域名映射IP地址 SQL 语句,类型转换 hyper-v 网络连接 VS2010 定位文件在solution中的位置 oracle连接字符串配置 spool的简单使用 open数据库Timeout expired 错误 ASCII码,对应e.KeyChar C# 调用计算器,日历 - 朱小能 - 博客园 Excel 如何由一个文本算术公式得到一个结果 Word、Excel中输入当前日期及时间的快捷键 c# ToString 格式化数字 - 朱小能 GridView绑定 获取access中表的相关信息 Filelog - 朱小能 - 博客园 List<T> 排序 - 朱小能 - 博客园
文件的还原与备份 - 朱小能 - 博客园
朱小能 · 2010-10-28 · via 博客园 - 朱小能

   1。 还原

    private void menuOpen_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();
            ofd.InitialDirectory = ConfigurationManager.AppSettings["FilePath"] + "DataBase";
            ofd.Title = "请选择需要打开的数据文件";
            ofd.Filter = "xxx数据文件|*.xxx|所有文件|*.*"; //后面加上你需要打开的文件类型
            ofd.CheckFileExists = true;
            ofd.CheckPathExists = true;
            ofd.Multiselect = false;

            if (ofd.ShowDialog() == DialogResult.OK)
            {
                string basepath = GlobalParam.DataPath + @"DataBase\xxxxxx.xxx";
                string renamepath = basepath.Substring(0, basepath.Length - 4) +
                    DateTime.Now.ToString("yyyyMMddHHmmss") + ".xxx";

      //重命名文件

                File.Move(basepath, renamepath);
                //拷贝文件

                File.Copy(ofd.FileName, basepath, true);                
            }
        }

   2。备份

        private void menuBackup_Click(object sender, EventArgs e)
        {
            SaveFileDialog sfd = new SaveFileDialog();
            sfd.Title = "保存";
            sfd.Filter = "xxx数据文件|*.xxx";
            sfd.CheckPathExists = true;
            sfd.RestoreDirectory = true;
            sfd.FileName = "xxxxxxx" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xxx";
            if (sfd.ShowDialog() == DialogResult.OK)
            {
                string basepath = GlobalParam.DataPath + @"DataBase\xxxxxxx.xxx";
                File.Copy(basepath, sfd.FileName, true);
            }
        }