I uploaded my site on godaddy shared host. I can access this database from my management studio. I can\'t access this database from my site
In my Case, it is because of having more than one connection string in your Solution. one for your current project and the other one for a startup project in your Solution. for more information please refer to Telerik report not working
here we have the same situation.
For my case, the culprit was the semicolon and double quotes in the password for prod DB. Our IT team use some tool to generate passwords, so it generated one with the semicolon and double quotes Connectionstring looks like
<add key="BusDatabaseConnectionString" value="Data Source=myserver;Initial Catalog=testdb;User Id=Listener;Password=BlaBla"';[]qrk/>
Got the password changed and it worked.
It might help to see what the actual connection string is. Add to Global.asax:
throw new Exception(ConfigurationManager.ConnectionStrings["mcn"].ConnectionString);
If the actual connection string is $(ReplacableToken_mcn-Web.config Connection String_0)
, that would explain the problem.
I was facing the same problem and found out that my connection string had an extra double-quote character in the middle of the connection string.
I originally was calling the connection string value as shown below (VB.NET) and got the error being mentioned
Using connection As New SqlConnection("connectionStringName")
'// more code would go here...
End Using
adding a reference to System.Configuration and updating my code as shown below was my solution. The connection string was not the problem since others controls used it without any issues (SqlDataSource)
Using connection As New SqlConnection(ConfigurationManager.ConnectionStrings("connectionStringName").ConnectionString)
'// more code would go here...
End Using
Another pitfall is that connectionString
sometimes refers to the name of the connection string in the app/web-config and sometimes to the actual connection string itself and vice versa.
Very easy to fix but sometimes hard to spot.