I want to connect SQL Server database which is in

2019-08-12 04:36发布

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

3条回答
Viruses.
2楼-- · 2019-08-12 04:57

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

查看更多
smile是对你的礼貌
3楼-- · 2019-08-12 04:58

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;" />
    
查看更多
爷的心禁止访问
4楼-- · 2019-08-12 05:09

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.

查看更多
登录 后发表回答