Last post Nov 24, 2014 03:48 PM by sen338
Nov 24, 2014 03:27 PM|vmcg105|LINK
I just pulled a project down from Github and was emailed a copy of the database (.bak file) for development. How do I import this database into the project?
Nov 24, 2014 03:38 PM|Rion Williams|LINK
If you have a SQL Server backup file (.bak), you'll likely need to restore the actual database associated with it. You can
find instructions here on how to use SQL Server Management Studio to do that.
After you have restored the database, you'll need to
build a connection string that targets your newly restored database within your ASP.NET application. Generally, a SQL Server connection string will look something like this within your web.config file :
<add name="YourConnectionString" connectionString="Server=YourServerAddress;Database=YourDatabase;User Id=Username;
From this point, you should be able to access and connect to your database. The most basic example of doing this would be using a SqlConnection object as seen below :
// Build your connection
using(SqlConnection sqlConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["YourConnectionString"].ConnectionString))
// Build your query (example)
var query = "INSERT INTO YourTable VALUES('Example','Values')";
// Build a command to execute
using(SqlCommand sqlCommand = new SqlCommand(query, sqlConnection))
// Open your connection
// Execute your query
Nov 24, 2014 03:45 PM|a2h|LINK
AFAIK the .bak file is used to restore the database back up in sqlserver. You might want to restore the database to your sqlserver db.
You can try Restore Database wizard available in SQL Server.
Please follow the below steps
Refer the below link for more details
Nov 24, 2014 03:48 PM|sen338|LINK
the below site may help you to restored your back up database.