summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--kurier/Form1.Designer.cs1
-rw-r--r--kurier/Form1.cs16
-rw-r--r--kurier/MySQL.cs6
3 files changed, 23 insertions, 0 deletions
diff --git a/kurier/Form1.Designer.cs b/kurier/Form1.Designer.cs
index 41ac97b..47549f4 100644
--- a/kurier/Form1.Designer.cs
+++ b/kurier/Form1.Designer.cs
@@ -49,6 +49,7 @@
//
// cbDatabaseName
//
+ this.cbDatabaseName.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbDatabaseName.FormattingEnabled = true;
this.cbDatabaseName.Location = new System.Drawing.Point(89, 10);
this.cbDatabaseName.Name = "cbDatabaseName";
diff --git a/kurier/Form1.cs b/kurier/Form1.cs
index eb6ab88..a8bd7eb 100644
--- a/kurier/Form1.cs
+++ b/kurier/Form1.cs
@@ -5,6 +5,7 @@ using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
+using MySql.Data.MySqlClient;
namespace kurier
{
@@ -29,11 +30,26 @@ namespace kurier
{
if (!MySQL.getConfigured()) (new MysqlSettings()).ShowDialog();
if (!MySQL.getConfigured()) this.Dispose();
+ this.refreshDatabaseList();
}
private void bSettings_Click(object sender, EventArgs e)
{
(new MysqlSettings()).ShowDialog();
+ this.refreshDatabaseList();
+ }
+
+ internal void refreshDatabaseList()
+ {
+ this.cbDatabaseName.Items.Clear();
+ MySQL c = new MySQL("");
+ MySqlDataReader dbs = c.select("SELECT TABLE_SCHEMA FROM information_schema.COLUMNS GROUP BY TABLE_SCHEMA;");
+ while (dbs.Read())
+ {
+ this.cbDatabaseName.Items.Add(dbs.GetString(0));
+ }
+ this.cbDatabaseName.SelectedIndex = 0;
+ dbs.Close();
}
}
}
diff --git a/kurier/MySQL.cs b/kurier/MySQL.cs
index cafb5c8..81a3a0b 100644
--- a/kurier/MySQL.cs
+++ b/kurier/MySQL.cs
@@ -61,6 +61,12 @@ namespace kurier
return "";
}
+ public MySqlDataReader select(string query)
+ {
+ MySqlCommand comm = new MySqlCommand(query, conn);
+ return comm.ExecuteReader();
+ }
+
public static string getHost() { return Properties.Settings.Default.HOST; }
public static string getUser() { return Properties.Settings.Default.USER; }
public static string getPass() { return Properties.Settings.Default.PASS; }