private void dbConnectionControl2_OnDatabaseConnected() { // do something on db-connection. conn = dbConnectionControl2.conn; tableFunctionsControl1.conn = dbConnectionControl2.conn; tableFunctionsControl1.MySqlInstallationPath = MySqlInstallationPath; tableFunctionsControl1.Enabled = true; tableFunctionsControl1.FillTableList(); tableFunctionsControl1.ShowADDML = false; tableFunctionsControl1.ShowCSV = false; tableFunctionsControl1.ShowXML = false; switch (dbConnectionControl2.ServerTypeSelected) { case "FireBird": tableFunctionsControl1.ShowCSV = true; break; case "MySql": tableFunctionsControl1.ShowCSV = true; tableFunctionsControl1.ShowXML = true; break; } }
private void button1_Click(object sender, EventArgs e) { //switch (cbServerType.SelectedItem.ToString()) //{ // case "MySql": // case "MSSql": if (cbRememberSettings.Checked) { Tools.SetSetting("servertype", cbServerType.SelectedIndex.ToString()); Tools.SetSetting("server", txtServer.Text); Tools.SetSetting("user", txtUser.Text); Tools.SetSetting("pass", txtPassword.Text); Tools.SetSetting("fdbfile", txtFDBFil.Text); Tools.SaveSettings(); logg1.Log("Innstillinger lagret." + Environment.NewLine, Logg.LogType.Info); } if (ShowDatabaseSelector && cbDatabase.SelectedItem == null) { logg1.Log("Vennligst bruk nedtrekksmenyen og velg en aktuell database." + Environment.NewLine, Logg.LogType.Error); return; } else { if (ShowDatabaseSelector) ConnectionHandler.Database = cbDatabase.SelectedItem.ToString(); } Cursor = Cursors.WaitCursor; try { if (conn == null) { var obj = Enum.Parse(typeof(ConnectionHandler.enDatabaseType), cbServerType.SelectedItem.ToString()); conn = new ConnectionHandler((ConnectionHandler.enDatabaseType)obj); } if (ConnectionHandler.Database != null) conn.CreateConnection(ConnectionHandler.Server, ConnectionHandler.Database, ConnectionHandler.Username, ConnectionHandler.Password); logg1.Log("Koblet til databaseserver " + ConnectionHandler.Server + "." + Environment.NewLine, Logg.LogType.Info); DatabaseConnected(); } catch (Exception ex) { logg1.Log("Tilkoblingen til databasen feilet. Kontroller innstillinger og prøv igjen." + Environment.NewLine + ex.Message + Environment.NewLine, Logg.LogType.Error); return; } finally { Cursor = Cursors.Default; } }
private void cbDatabase_DropDown(object sender, EventArgs e) { cbDatabase.Items.Clear(); Cursor = Cursors.WaitCursor; try { conn = new ConnectionHandler((ServerTypeSelected=="MySql"?ConnectionHandler.enDatabaseType.MySql: (ServerTypeSelected=="SqlServer"?ConnectionHandler.enDatabaseType.MSSql:ConnectionHandler.enDatabaseType.FireBird))); cbDatabase.Items.AddRange(conn.GetListOfDatabases().ToArray()); button1.Enabled = true; } catch (Exception ex) { logg1.Log("Feil ved tilkobling. Kontroller innstillinger og prøv igjen." + Environment.NewLine + ex.Message + Environment.NewLine, Logg.LogType.Error); } Cursor = Cursors.Default; }
private void dbConnectionControl1_OnDatabaseConnected() { // do something on db-connection. conn = dbConnectionControl1.conn; FillTableList(); }