Friday, July 31, 2009

My C# program fails to establish connection to SQL Server during Data Form Wizard on Visual Studios. Why?

I was trying to create a program that would retrieve information from an SQL Server database, located at the Master folder, but the error message provided was "Server does not exist or access denied". I already added the SQL Server name, and set it on "NT Authetication", since I did not specify the username and password for the server itself. What went wrong?

My C# program fails to establish connection to SQL Server during Data Form Wizard on Visual Studios. Why?
A couple of things to try:





Can you ping the server from your PC? Drop to a command prompt and type in Ping ???? where ???? is the servers name. Can you ping it? If not, verify the servers IP address by going to the server and typing at a command prompt


ipconfig /all





It'll display it's IP address and you should then see if you can ping it from your development PC. If you can, use the IP address in your connection string.





If you can Ping it see if you can telent to it. MS SQL Server listens on port 1433. Drop to a command prompt and type in


Telnet ???? 1433


Does the command prompt screen clear with a cursor blinking or does it return an error? If it returns an error then the server is not listening. Make sure SQL Agent is running and make sure that the server is actually running by going onto the server and starting the Enterprise Manager or Management Studio and see if you can do some queries.
Reply:from all my experience in .NET programming, i know you always need a user id and password on a database, even for a sample coding/ trying out..





why dont u create a simple user id of 'test' with a password '1234' then give it a permission of a normal user. it should be able to work..





also, another thing can be wrong is the configuration of your connector. if you are using odbc or msodbc, be sure to check its configuration. a number of times i got this not configured and ending up getting the same error message as yours





hope that helps and do note that just setting up a database for connection and data retrieval may take up to a whole day even for seasoned programmers
Reply:Is your SQL Service running?


Start--%26gt;Run--%26gt;services.msc


In services Look for:


SQL Server started


if it is blank you need to start it. right click and start.
Reply:What's the connection string?





Does the SQL Server support TCP/IP connections?


No comments:

Post a Comment