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);

             }

    人的一生应该这样度过:当他回首往事的时候,不会因为虚度年华而悔恨,也不会因为碌碌无为而羞愧。
  • 相关阅读:
    [算法]最长的可整合数组的长度
    [算法]在行列都排好序的矩阵中找数
    [算法]在数组中找到出现次数大于N/K的数
    [算法]需要排序的最短子数组长度
    [算法]找到无序数组中最小的K个数
    [算法]“之”字形打印矩阵
    [java]final关键字、finally关键字与finalize()方法
    [算法]旋转矩阵问题(Spiral Matrix)
    [算法]位运算问题之三(实现加减乘除)
    [IDE]Intellij Idea学习整理
  • 原文地址:https://www.cnblogs.com/htht66/p/889748.html
Copyright © 2011-2022 走看看