Click here to Skip to main content
14,825,178 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have a SQL database for my little site
this connection string was working on site but host had some changes and it does not working anymore
<add name="connectionStringName" 
connectionString="Initial Catalog=siteIp;
User ID=userName; 
providerName="System.Data.SqlClient" />

i tried to fix it and use this connection string in visual studio and every thing is ok
but this not working on website!
i changed web.config on site and refresh the site but not working!

<add name="connectionStringName" 
connectionString="Data Source=siteIp; 
Initial Catalog=databaseName; 
User ID=userName; 
providerName="System.Data.SqlClient" />

i am wondering why this work on visual studio but not working in site?

What I have tried:

i can login to my database by SQL Server Managment Studio
Server Name:siteIp
Updated 12-Sep-20 10:03am

Check that the actual server is visible from the client computer, and that there are no firewalls in place that might block SQL Server: Configure Windows Firewall - SQL Server | Microsoft Docs[^]
It's pretty obvious, but check the server he is connecting to does have the DB installed under SQL - if you are Attaching a DB for example then that will only work to Express editions of SQL Server, not Production.
Then check what the actual server he is using has configured in terms of users and passwords: unless he is using the same server as you it's likely that the users are not set up.
Also look at any error messages generated by the connection process - they can often tell you what area the problem is.
I published whole site and uploaded it again and everything is ok
i do not know why editing connection string in web.config file not working

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

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