public static string[] GetMySQLDatabases(ConnectionStringHelper helper) { string serverName = helper.ServerName; string userName = helper.UserName; string password = helper.Password; bool trustedConnection = helper.UseIntegratedSecurity; UniConnection conn; //if (trustedConnection) // conn = new UniConnection(string.Format("Provider=MySQL;host=server;user=root;password=root;database=myDB", serverName)); //else //conn = new UniConnection(string.Format("Provider=MySQL;host={0};user={1};password={2};database=myDB", serverName, userName, password)); conn = new UniConnection(string.Format("Provider=MySQL;direct=true;host={0};user={1};password={2};", serverName, userName, password)); List<string> databaseNames = new List<string>(); try { conn.Open(); DataTable table1 = conn.GetSchema("Databases"); foreach (DataRow row in table1.Rows) { string dbName = row[0].ToString(); databaseNames.Add(dbName); } } finally { conn.Close(); } return databaseNames.ToArray(); }
public static string[] GetFirebirdDatabases(ConnectionStringHelper helper) { string serverName = helper.ServerName; string userName = helper.UserName; string password = helper.Password; int port = helper.Port; bool trustedConnection = helper.UseIntegratedSecurity; UniConnection conn = new UniConnection(string.Format("Provider=Firebird;direct=true;Server={0};User={1};Password={2};Port={3};", serverName, userName, password, port)); List <string> databaseNames = new List <string>(); try { conn.Open(); DataTable table1 = conn.GetSchema("Databases"); foreach (DataRow row in table1.Rows) { string dbName = row[0].ToString(); databaseNames.Add(dbName); } } finally { conn.Close(); } return(databaseNames.ToArray()); }
public static string[] GetMySQLDatabases(ConnectionStringHelper helper) { string serverName = helper.ServerName; string userName = helper.UserName; string password = helper.Password; bool trustedConnection = helper.UseIntegratedSecurity; UniConnection conn; //if (trustedConnection) // conn = new UniConnection(string.Format("Provider=MySQL;host=server;user=root;password=root;database=myDB", serverName)); //else //conn = new UniConnection(string.Format("Provider=MySQL;host={0};user={1};password={2};database=myDB", serverName, userName, password)); conn = new UniConnection(string.Format("Provider=MySQL;direct=true;host={0};user={1};password={2};", serverName, userName, password)); List <string> databaseNames = new List <string>(); try { conn.Open(); DataTable table1 = conn.GetSchema("Databases"); foreach (DataRow row in table1.Rows) { string dbName = row[0].ToString(); databaseNames.Add(dbName); } } finally { conn.Close(); } return(databaseNames.ToArray()); }
public static string[] GetFirebirdDatabases(ConnectionStringHelper helper) { string serverName = helper.ServerName; string userName = helper.UserName; string password = helper.Password; int port = helper.Port; bool trustedConnection = helper.UseIntegratedSecurity; UniConnection conn = new UniConnection(string.Format("Provider=Firebird;direct=true;Server={0};User={1};Password={2};Port={3};", serverName, userName, password, port)); List<string> databaseNames = new List<string>(); try { conn.Open(); DataTable table1 = conn.GetSchema("Databases"); foreach (DataRow row in table1.Rows) { string dbName = row[0].ToString(); databaseNames.Add(dbName); } } finally { conn.Close(); } return databaseNames.ToArray(); }
private void cbDatabase_DropDown(object sender, System.EventArgs e) { try { ComboBox combo = (ComboBox)sender; connection.ConnectionString = BuildConnectString(); connection.Database = ""; connection.Open(); System.Data.DataTable databases = connection.GetSchema("Databases"); combo.Items.Clear(); foreach (System.Data.DataRow row in databases.Rows) { combo.Items.Add(row[0]); } } catch (Exception) { } }