I want to connect SQL Server database which is in .bak format to the ASP.net web application that I have created

偶尔善良 提交于 2019-12-13 01:42:18

问题


I have created an ASP.Net web application with SQL Server 2005 database on another computer.

I want to transfer it to another PC. Therefore, I have copied the ASP.Net Project and also the SQL database in .bak format. I need to configure the application to connect to the database and need help to get the correct connection string.

PS: the database created was by SQL Server 2005 and I need to deploy on SQL Server 2012


回答1:


bak files are Sql Server backup files. You need to restore it into the Sql Server 2012 and go from there.

Restoring database files in Sql Server 2012 -> http://msdn.microsoft.com/en-us/library/ms177429.aspx

And the connection string to connect you application to it -> http://connectionstrings.com/sql-server-2012




回答2:


You have to restore the database on new sql server 2012, then you can make a new connection string. If you leave the name the same, you only have to change the name of the server in the connection string.




回答3:


Links by "tucaz" are good examples to start with. You can also follow these steps to get an idea.

  1. Create new database on SQL server 2012 on new PC

  2. Right click newly created database and find Restore database option. Give .bak files needed to restore

  3. Make sure to select "Overwrite the existing database (WITH REPLACE)" option in restore database file window

  4. Once the backup is restored, the use the following format of the connection string on application config file.

    <add name="connectionstring" 
         connectionString="Data Source=ServerName;Initial catalog=DBName;user id=UserName;password=password;Language=British;" />
    


来源:https://stackoverflow.com/questions/13932743/i-want-to-connect-sql-server-database-which-is-in-bak-format-to-the-asp-net-web

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!