Reputation: 73
I have the following connection strings in development using visual studio web developer 2010 express:
<connectionStrings>
<add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient" />
<add name="ConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\ASPNETDB.MDF;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient" />
<add name="DatabaseConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=C:\BegASPNET\Cheeztest\App_Data\Database.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True" providerName="System.Data.SqlClient" />
<add name="DatabaseEntities" connectionString="metadata=res://*/App_Code.CheeztestModel.csdl|res://*/App_Code.CheeztestModel.ssdl|res://*/App_Code.CheeztestModel.msl;provider=System.Data.SqlClient;provider connection string="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Database.mdf;Integrated Security=True;User Instance=True;MultipleActiveResultSets=True"" providerName="System.Data.EntityClient" />
What do I need to change/delete/keep in order to connect to a GoDaddy account with the following parameters:
Host Name: someresource.com Database Name: databasedb Username: databasedb Password: password
I am hosting on a GoDaddy account that only allows a single MS SQL database. In development I had two separate databases; one was ASPNETDB.MDF and the other was Database.MDF. Do I also need to have two separate databases in the hosted environment?
I forgot to mention that yes, GoDaddy does provide a configuration string. I have been trying for two days to make it work without success which is why I am posting here.
The string provided by GoDaddy is:
Data Source=somesource.com; Initial Catalog=databasedb;User ID=databsedb; Password=password;
Also, if necessary I can upgrade my GoDaddy account and get another database. Which I am willing to do if it will make my life easier.
Upvotes: 1
Views: 4060
Reputation: 387
No need to upgrade the plan from Go Daddy or even do not buy extra Database. You can do like, you merge two databases into single database. All the tables from second database will be under first database. Then you can use only one connection string for your multiple applications hosted on same server or different server.
Upvotes: 0
Reputation: 233
For your limitation with only one sql database with godaddy one option will be to consolidate your two databases in one.
About the connection strings if you're using visual studio 2010 there's a new feature that allows to make transformations in the web.config based on the build settings so you can have a development and production settings that will transform the web.config automatically. You can find more information about that here, http://www.hanselman.com/blog/WebDeploymentMadeAwesomeIfYoureUsingXCopyYoureDoingItWrong.aspx
If vs 2010 is not an option then one solution can be to have an application key in your web.config , something like enviroment="development" and then in code when connecting to the database choose the appropiate connection string based on that application setting.
Upvotes: 1
Reputation: 161
Go Daddy gives you a connection string that you can copy and paste into your web.config that is specific to your database once you set it up. You would just need to make sure you keep the name property the same and you shouldn't have any problems (as long as the DB schema is the same as well).
If you have two databases that you are accessing in your code, you either need to combine them or use two in the hosted environment. Why two in the first place? Is one for the asp.Net users and roles and the other for site data? If that's the case, I would combine them and change my site code to use one connection string.
Upvotes: 1