满意的工作就是对它感兴趣

希望和大家一起研究,并沉醉其中

博客园 首页 新随笔 联系 订阅 管理

 public void BackUp()
        {

            String str;
            SqlConnection conn = new SqlConnection("Server=smiles;uid=sa;pwd=sa;Integrated security=SSPI;database=log1");

            str = "BACKUP DATABASE log1 TO disk='\\cxc\007\northwind.bak'";//disk='d:\\aa\\a.bak'

            SqlCommand command = new SqlCommand(str, conn);
            try
            {
                conn.Open();
                command.ExecuteNonQuery();
                MessageBox.Show("backup Successfully");
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                if (myConn.State == ConnectionState.Open)
                {
                    myConn.Close();
                }
            }
        }

posted on 2007-01-09 17:31  半瓶之迷迷糊糊  阅读(107)  评论(0)    收藏  举报