日期:2014-05-18 浏览次数:20388 次
SqlConnection conn = new SqlConnection(); conn.ConnectionString = "server=10.68.69.203,81;database=cpudata;user id =sa;password=19790601"; try { //------------------结论这种方法是不合适的--------------------- conn.Open(); Console.WriteLine(conn.State.ToString()); SqlCommand cmd = new SqlCommand(); cmd.Connection = conn; cmd.CommandText = "backup database cpudata to disk='d:\a.bak'"; int i = cmd.ExecuteNonQuery(); Console.WriteLine(i.ToString()); } catch (Exception ex) { throw ex; } finally { conn.Close(); } Console.ReadLine();