Click here to Skip to main content
15,881,172 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
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
Posted

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.
 
Share this answer
 
v2
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.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900