I am trying to connect my .NET web service to a SQL Server via ODBC Connection.
Here is my ODBC Connection
Then I created a Data Connection in the Server Explorer via VS2017:
In the web.config, I have the following:
<connectionStrings>
<add name="MyConnection" connectionString="Dsn=NGDEV" providerName="System.Data.SqlClient"/>
</connectionStrings>
In my code, I connect by
using(OdbcConnection connection = new OdbcConnection(ConfigurationManager.ConnectionStrings["MyConnection"].ConnectionString))
using(OdbcCommand command = connection.CreateCommand() {
command.CommandText = "SELECT * FROM table1";
connection.Open(); // This is where I get the error
}
The error message is:
Login failed for user ''.
I noticed that the user is blank. I don't understand why. I know that the connection works because I tested it.