I'm trying to build a C# WPF application that can connect to multiple types of databases via DSN and I've hit a snag. Normally the connection info (username/password) is entirely stated in the ODBC connection but when trying to connect to an SQL server (that I set up for test purposes) I've run into some problems.
If I try
string connString = $"DSN={dsn};";
OdbcConnection cnn = new OdbcConnection(connString);
cnn.Open()
I get an error
"Login failed for user ''."
If I change the connection string to specifically state the username and password like
string connString = $"DSN={dsn}; UID = {username}; PW = {password};";
I get the same error plus
Invalid connection string attribute
I've tried different versions of this after searching for different connection string examples but I'm stumped. It appears like the server is returning an error that I passed it the username '' rather than the actual login name (CCLogin), and also that the connection string is in the wrong format but I can't find any problems with the format...