I'm having trouble connecting to SQL Server 2012 database using C#. I get the following error message when I try to connect:
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 25 - Connection string is not valid)
Note, both the server and software are on the same computer and I am using an SQL login called Logger, mapped to the database using the same text as the password.
I'm trying to connect using this:
SqlConnection sql = new SqlConnection("Server=(local)MSSQLSERVER;Database=Test;User ID=logger;Password=logger;Trusted_Connection=False");
I'm pretty sure I have the server set up to take remote logins. Any idea as to what I am missing?
Free Guide: Managing storage for virtual environments
Complete a brief survey to get a complimentary 70-page whitepaper featuring the best methods and solutions for your virtual environment, as well as hypervisor-specific management advice from TechTarget experts. Don’t miss out on this exclusive content!