Example #1
0
        private string getTableColumns(string tableName)
        {
            if (con.Connected())
            {
                sb = new StringBuilder();

                MySqlCommand    cmd    = new MySqlCommand(@"SELECT column_name as 'Column Name'
                                                      FROM information_schema.columns
                                                      WHERE table_name = '" + tableName + "'", con.TheConnection);
                MySqlDataReader reader = cmd.ExecuteReader();

                while (reader.Read())
                {
                    sb.Append(reader["Column Name"].ToString());
                    sb.Append(',');
                }
                reader.Close();
                tableColumns = sb.ToString().Substring(0, sb.ToString().LastIndexOf(','));

                return(tableColumns);
            }
            else
            {
                MessageBox.Show("No Active Connection");
                con.Disconnect();
                return(null);
            }
        }
Example #2
0
 protected void backgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
 {
     timer.Stop();
     label1.Visible       = false;
     label2.Visible       = false;
     label3.Visible       = false;
     progressBar1.Enabled = false;
     progressBar1.Visible = false;
     dt.Clear();
     dt.Dispose();
     con.Disconnect();
     counter = 0;
     nbRows  = 0;
     timer.Reset();
     this.Close();
 }
Example #3
0
 private void ConnectionBtn_Click(object sender, EventArgs e)
 {
     con = new DBInstance(serverTxt.Text, databaseTxt.Text, usernameTxt.Text, passwordTxt.Text);
     if (con.Connected())
     {
         lblWaiting.Text = "Connecting to " + con.ConnectionString().Substring(con.ConnectionString().IndexOf('=') + 1).Substring(0, con.ConnectionString().IndexOf(';') - (con.ConnectionString().IndexOf('=')) - 1);
         con.Disconnect();
         Connection();
     }
     else
     {
         con.Connection();
         lblWaiting.Text = "Connecting to " + con.ConnectionString().Substring(con.ConnectionString().IndexOf('=') + 1).Substring(0, con.ConnectionString().IndexOf(';') - (con.ConnectionString().IndexOf('=')) - 1);
         con.Disconnect();
         Connection();
     }
 }