I have a connection string, for example:
"SERVER=localhost;DATABASE=tree;UID=root;PASSWORD=branch;Min Pool Size = 0;Max Pool Size=200"
How do I get various database parameters? I can get the database name and server as follows:
serverName = conObject.DataSource; dbName = conObject.Database;
I also need a username and password. The MySqlConnection object is not defined.
I am currently doing it like this:
public static void GetDatabaseParameters(string connectionString, out string serverName, out string dbName, out string userName, out string password) { Match m = Regex.Match(connectionString, "SERVER=(.*?);DATABASE=(.*?);UID=(.*?);PASSWORD=(.*?);.*");
Is there any accepted practice here?
nawfal Apr 02 2018-12-12T00: 00Z
source share