private void Form1_Load(object sender, EventArgs e) { buttonASC.Checked = true; limitTB.Text = "100"; label3.Text = "Count: "; timer1.Enabled = true; radioButton1.Checked = true; dbDroplist = TestToConnectMySQLServer.FillData(showDB, connection); tableDroplist = TestToConnectMySQLServer.FillData(showTables + db, connection); foreach (DataRow _ in dbDroplist.Rows) { string db = _["Database"].ToString(); comboBox3.Items.Add(db); } comboBox3.SelectedItem = db; }
private void GetTable() { CreateSQL(); connection = TestToConnectMySQLServer.OpenConnection(Form2.server, Form2.port, db, Form2.userID, Form2.password); if (checkBox1.Checked) { searchList = TestToConnectMySQLServer.FillData(dbSQLEditor, connection); } else { searchList = TestToConnectMySQLServer.FillData(dbSQL, connection); } }
private void comboBox3_SelectedIndexChanged(object sender, EventArgs e) { db = comboBox3.SelectedItem.ToString(); comboBox1.Items.Clear(); comboBox2.Items.Clear(); radioButton1.Checked = true; checkedListBox1.Items.Clear(); dataGridView2.DataSource = null; tableDroplist = TestToConnectMySQLServer.FillData(showTables + db, connection); foreach (DataRow _ in tableDroplist.Rows) { string table = _["Tables_in_" + db].ToString(); comboBox1.Items.Add(table); } }
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { setConditionTable = new DataTable(); setConditionTable.Rows.Add(); setConditionTable.Rows.Add(); comboBox2.Items.Clear(); radioButton1.Checked = true; dbTable = comboBox1.SelectedItem.ToString(); string dbFields = "show fields from " + dbTable + " from " + db; tableFields = TestToConnectMySQLServer.FillData(dbFields, connection); DataTable dataTable = tableFields.Copy(); foreach (DataColumn _ in tableFields.Columns) { if (_.ColumnName != "Field") { dataTable.Columns.Remove(_.ColumnName); } } dataGridView2.DataSource = dataTable.DefaultView; checkedListBox1.Items.Clear(); int i = 0; foreach (DataRow dataRow in tableFields.Rows) { setConditionTable.Columns.Add(dataRow["Field"].ToString(), typeof(string)); checkedListBox1.Items.Add(dataRow["Field"]); checkedListBox1.SetItemChecked(i++, true); comboBox2.Items.Add(dataRow["Field"]); } foreach (DataRow dataRow in tableFields.Rows) { comboBox2.SelectedItem = dataRow["Field"].ToString(); if (dataRow["Field"].ToString() == "Time") { comboBox2.SelectedItem = dataRow["Field"].ToString(); break; } else if (dataRow["Field"].ToString() == "ID") { comboBox2.SelectedItem = dataRow["Field"].ToString(); break; } else if (dataRow["Field"].ToString() == "Id") { comboBox2.SelectedItem = dataRow["Field"].ToString(); break; } else { } } }