I am struggling a bit with this piece of C# code. Basically, what I'm trying to do is some kind of mechanism to check if, in first place, the user and password combination for my SQL server was correct, and then, check if the database exists.
The connection string would be like this:
connectionString =
"database=test;server=localhost;uid=" + usr.Text + ";pwd=" + pwd.Text;
The solution I'm trying to reach is one that can check the exception thrown and tell if it's about a wrong password, a wrong user, not found database, etcetera. I've seen the use of DbConnectionStringBuilder in some places but I'm not sure of how I should use it.