zoukankan      html  css  js  c++  java
  • SqlServer2000数据库备份

     
     

    private void Button4_Click(object sender, System.EventArgs e)

             {

                  string dataName=System.DateTime.Now.ToString();//获取当前时间

                  dataName=dataName.Replace("-","");//去掉'-'

                  dataName=dataName.Replace(" ","");//去掉空格

                  dataName=this.txtDataName.Text+dataName.Replace(":","");//去掉':'

                  string logicFile=this.txtDataName.Text+dataName;//逻辑名称-输入名称+时间

                  string dataPath;

                  string tempPath;

                  tempPath=this.txtPath.Text.Trim();

                  System.IO.DirectoryInfo dicinfo=new System.IO.DirectoryInfo(tempPath);//判断是否存在

                  if(!dicinfo.Exists)

                  {

                       dataPath=Server.MapPath("Admin/DataBack/")+dataName+".dat";

                  }

                  else

                  {

                       dataPath=tempPath;

                  }

                  string str=" EXEC sp_addumpdevice 'disk', '"+logicFile+"','"+dataPath+"'";//建立文件组

                  string str2="BACKUP DATABASE qiking TO "+logicFile;//执行备份

                  DAL.SQLHelper.ExecuteNonQuery(DAL.SQLHelper.CONN_STRING,System.Data.CommandType.Text,str);

                           DAL.SQLHelper.ExecuteNonQuery(DAL.SQLHelper.CONN_STRING,System.Data.CommandType.Text,str2);

             }

    人的一生应该这样度过:当他回首往事的时候,不会因为虚度年华而悔恨,也不会因为碌碌无为而羞愧。
  • 相关阅读:
    【转】使用TortoiseSVN搭建本地的版本控制库
    操作系统的大端小端
    从《王者荣耀》谈游戏的帧同步
    二叉搜索树的第K大节点
    Mysql千万级大表优化
    海量数据存储方案
    递归函数思维
    time_wait的快速回收和重用
    Nginx配置反向代理服务器
    MySQL-怎样使update操作sleep一段时间
  • 原文地址:https://www.cnblogs.com/htht66/p/889748.html
Copyright © 2011-2022 走看看