Jump to content
Xtreme .Net Talk

Recommended Posts

  • Administrators
Posted
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();

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Posted

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...