mysql - SQL c# determining type of sql server -
does know of way, programmatically, determine if sql server mysql or mssql installation?
i've got app in c# has able connect either mysql or mssql. can connect either if know is, can't tell connection settings because server name, userid, password, , database name.
i can have settings file store type of server, opens avenue user error i'd avoid.
try connect mysql , if fails, handle error gracefully try connect mssql. loosely similar might work ...
string finddbtype(string connectionstring) { try { // try connect mysql return "mysql"; } catch() { try { // try connect mssql return "mssql"; } catch() { return "cannot determine db type" } } }
you want handle errors incorrect password separately, should started.
Comments
Post a Comment