+92 332 4229 857 99ProjectIdeas@Gmail.com

How to restore database (SQL Server)


How to restore database (SQL Server)
In this post we’ll learn how we can restore database from drive and show in SQL server for our usage. See the steps below:

Step no. 1
Open the SQL server and press Connect button
You see above Server name = "MOAVIA_OSAMA-PC\SQLEXPRESS" this is my server name so while establishing connection with SQL server we write the connection string like this:
     
public static string conString = @"Data Source =  MOAVIA_OSAMA-PC\SQLEXPRESS;Initial Catalog = MyFirst ; Integrated Security = true";
      
     Note
     In your case you must define your own Server name infront of Data Source and Database infront of Initial Catalog, while establishing connection string to connect with SQL server. 

Step no. 2
  Right click on Databases and choose Restore Database


Step no. 3
  By Clicking On Restore Database, the following window will open: Choose From Device and go to browse button as mentioned below:


  
Step no. 4
  By Clicking On Browse Button, the following window will open:


Step no. 5
  By Clicking On Add Button, and browse to the path where your .bak file is stored:

Step no. 6
  By Clicking On two times Ok Button, then following window will appear, and see the mentioned labels, what you must do:


  your database restored successfully:


0 comments: