Friday, February 24, 2012

ASPNETDB migration

I created a website using Visual web developer express edition (including SQL Express). No the user management section of the site (the login/logout database) was created automatically and SQL Server express was installed at my computer under the instance name of SQLExpress. I uploaded it to my web host and he hooked up the ASPNETDB for me. Now the problem is that ASPNETDB has an id password and I was given theMSSQL Server IP. How do I configure my website to accommodate that? Any help will be extremely useful!!!

you need to modify the connection string in web.config

<connectionStrings>
<remove name="LocalSqlServer"/>
<add name="LocalSqlServer" connectionString="server=server ip;database=ASPNETDB;uid=youUsername;pwd=yourpassword"
providerName="System.Data.SqlClient"/>

</connectionStrings>

|||

WOW! Thats it! Thanks a bunch. One more thing. I am also using the same database to display some data(have added some tables into it manually). What should I put in the connection string to make the connection to the database? Also, can I use a MySQL database instead? If yes, what will be the connection string?

Thanks for your help.

|||

if you don't want to use the same name "LocalSqlServer", then you can add another connection with the same connectionString
like:

<add name="yourConnName" connectionString="server=server ip;database=ASPNETDB;uid=youUsername;pwd=yourpassword"
providerName="System.Data.SqlClient"/>

I am not sure if you can use MySQL as a configuration Database, but you can use it for application database.

Honestly, I didn't use it before. to get the exact connection string for MySQL, try to add a coonection from the wizard and see how vs2005 creates it in web.config

No comments:

Post a Comment