多个MS SQL数据库 [英] Multiple MS SQL databases

查看:71
本文介绍了多个MS SQL数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我使用godaddy作为托管服务提供商,MS SQL数据库的大小只有200 MB,我想知道如何在一个asp.net网站上使用多个数据库。

支持将不胜感激。

问候

Shahali

Hi,
I am using godaddy as hosting provider & the size of MS SQL database is 200 MB only, I would like to know how to use the multiple databases in one asp.net website.
Support will be appreciated.
Regards
Shahali

推荐答案



您可以使用多个数据库(但在您的情况下单独使用)。为此,您可以在web.config中设置连接字符串两次。假如你有


add name =DB1connectionstring =Data Source = HP-PC; Database = erp; User id = sa; Password = ****providername =System.Data.SqlClient



用于您的第一个数据库,并且您希望将新数据库与现有数据库一起使用您可以再次使用新名称设置新的连接字符串,如下所示



add name =DB2connectionstring =Data Source =您的服务器; Database = databaseMy ;用户id = sa;密码= *****providername =System.Data.SqlClient



现在的重点是如何使用第一个和第二个,所以当你定义你的连接对象时,你必须使用不同的名称[连接字符串]作为DB1或DB2

现在连接对象在该数据库上工作

如果有进一步的问题可以试试。然后你可以问。
Hi,
you can use multiple databases (but individually in your case). to do this you can set your connection string two times in your web.config. suppose if you have

add name="DB1" connectionstring="Data Source=HP-PC;Database=erp;User id=sa;Password=****" providername="System.Data.SqlClient"

for your first database and you like to use a new database with existing one then you can again set a new connection string with new name as below

add name="DB2" connectionstring="Data Source=your server;Database=databaseMy;User id=sa;Password=*****" providername="System.Data.SqlClient"

now the main point is that how to use first one and second one, so when you define your connection object you have to use different names [connection string] as DB1 or DB2
now that connection object works on that database
try it if further issue then you can ask.


你可以根据需要在ASP.Net应用程序中拥有尽可能多的数据库。



真正的问题是如何在代码隐藏中管理这些连接字符串。如何知道应用程序是否应该知道新的连接等等。



我的建议:

获得另一个提供商,还有数百个这将为您提供更好的数据库大小。
You can have as many DBs in an ASP.Net application as needed.

The real question is how are you going to administer those connection strings in your code-behind. How is the application going to know a new connection should exist, etc.

My advise:
Get another provider, there are hundreds more that'll give you better DB size.


这篇关于多个MS SQL数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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