wondery Posted October 15, 2003 Posted October 15, 2003 i want user can backup database by click button Quote
Administrators PlausiblyDamp Posted October 15, 2003 Administrators Posted October 15, 2003 What database are you using? Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Administrators PlausiblyDamp Posted October 20, 2003 Administrators Posted October 20, 2003 System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection(); System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand(); //Open connection as per usual conn.ConnectionString="Data Source=.;Initial Catalog=Northwind;uid=sa"; conn.Open(); //backup database cmd.Connection=conn; cmd.CommandText="BACKUP DATABASE TO DISK = '' "; cmd.ExecuteNonQuery(); Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
wondery Posted October 21, 2003 Author Posted October 21, 2003 it error Could not locate entry in sysdatabases for database 'newattorney'. No entry found with that name. Make sure that the name is entered correctly. BACKUP DATABASE is terminating abnormally. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.SqlClient.SqlException: Could not locate entry in sysdatabases for database 'newattorney'. No entry found with that name. Make sure that the name is entered correctly. BACKUP DATABASE is terminating abnormally. System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection(); System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand(); //Open connection as per usual conn.ConnectionString="Data Source=.;Initial Catalog=attorney;uid=sa;password=xxx"; conn.Open(); //backup database cmd.Connection=conn; cmd.CommandText="BACKUP DATABASE newattorney TO DISK = '" + Server.MapPath("backup/") + "'"; cmd.ExecuteNonQuery(); Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.