是否可以备份数据库并使用与连接字符串中相同的名称存储它 [英] is it posible to take the backup of a database and storing it with the same names as in the connecting strings

查看:51
本文介绍了是否可以备份数据库并使用与连接字符串中相同的名称存储它的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个项目,我已经创建了一个数据库,我使用了连接字符串和我的qsl服务器的名称,如

i have a project where i have created a database with and i have used the connection string with the name of my qsl server like

Quote:

SqlConnection con = new SqlConnection(Data Source = SHANTANU \\ SQLEXPRESS; Initial Catalog = ankur; Integrated Security = True);

SqlConnection con = new SqlConnection("Data Source=SHANTANU\\SQLEXPRESS;Initial Catalog=ankur;Integrated Security=True");



这里的shanatnu \\sqlexpress是我的服务器名称。

现在我必须进行备份并将同一个数据库恢复到另一台具有sql服务器名称为HCL的计算机。

所以我需要做些什么才能使我的连接字符串工作正常。

因为我的数据库的所有连接都采用这个字符串名称。


here the shanatnu\\sqlexpress is my server name.
and now i have to take the backup and restore the same database into another computer with sql server name as HCL .
so what cahnges i have to make so that my connecting strings can work fine.
as all the connectivity of my database is taking with this string name.

推荐答案

您的连接字符串只需指向数据库。它将是服务器名称,然后是实例名称(如果不使用默认实例)。请查看 http://www.connectionstrings.com/ [ ^ ]



但是你可以在恢复时将数据库命名为db连接字符串指向它。
Your connection string just needs to point to the database. It will be server name and then instance name (if not using the default instance). Look at http://www.connectionstrings.com/[^]

But you can name the db whatever you want when you restore just as long as the connection string points to it.


这篇关于是否可以备份数据库并使用与连接字符串中相同的名称存储它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆