public string[] DisplayTables(string database) { ConnString conn = new ConnString(); conn.SetDatabase(database); string query = "show tables from " + database; MySqlConnection connection = new MySqlConnection(conn.getConnString()); MySqlCommand command = new MySqlCommand(query, connection); connection.Open(); MySqlDataReader reader = command.ExecuteReader(); List <string> rowList = new List <string>(); while (reader.Read()) { rowList.Add(reader[0].ToString()); } string[] rows = new string[rowList.Count]; for (int i = 0; i < rows.Length; i++) { rows[i] = rowList.ElementAt(i); } reader.Close(); connection.Close(); return(rows); }
public ViewTableForm(ConnString cs, string table) { InitializeComponent(); conn = cs; this.table = table; DisplayTable(); }
public DBTablesForm(ConnString cs, string database) { InitializeComponent(); this.database = database; conn = cs; conn.AddDatabase(database); DisplayTables(); }
public InsertTupleForm(ConnString cs, string table) { InitializeComponent(); conn = cs; this.table = table; DisplayInsertPanelContents(); PrepareTextBoxes(); }
private void button1_Click(object sender, EventArgs e) { string server = ServerTB.Text; string userID = textBox2.Text; string password = textBox3.Text; ConnString conn = new ConnString(server, userID, password); ConnectDB connect = new ConnectDB(conn); connect.connectToDBMS(conn); }
public void InsertTuple(string Tblname) { ConnString conn = new ConnString(); MySqlConnection connect = new MySqlConnection(conn.getConnString()); connect.Open(); MySqlCommand cmd = connect.CreateCommand(); cmd.CommandText = "INSERT INTO" + Tblname + "VALUES(?,?)"; cmd.Parameters.Add("?", MySqlDbType.VarChar).Value = ""; cmd.Parameters.Add("?", MySqlDbType.VarChar).Value = ""; cmd.ExecuteNonQuery(); connect.Close(); }
//public string[] DisplayTable(string database, string table) //{ // ConnString conn = new ConnString(); // conn.SetDatabase(database); // string query = "SELECT * From " + table; // MySqlConnection connection = new MySqlConnection(conn.getConnString()); // MySqlCommand command = new MySqlCommand(query, connection); // connection.Open(); // MySqlDataReader reader = command.ExecuteReader(); // List<string> rowList = new List<string>(); // while (reader.Read()) // { // rowList.Add(reader[0].ToString()); // } // string[] rows = new string[rowList.Count]; // for (int i = 0; i < rows.Length; i++) // rows[i] = rowList.ElementAt(i); // reader.Close(); // connection.Close(); // return rows; //} public void SelectTable(string database, string table) { ConnString conn = new ConnString(); conn.SetDatabase(database); MySqlConnection connection = new MySqlConnection(conn.getConnString()); connection.Open(); bool connect = true; if (connect == true) { ViewTableForm veiwTable = new ViewTableForm(table); veiwTable.Show(); } }
public void connectToDBMS() { DatabasesForm form2 = new DatabasesForm(); ConnString connect = new ConnString(); conn = new MySqlConnection(); if (connection == false) { conn.ConnectionString = connect.getConnString(); conn.Open(); connection = true; } if (connection == true) { MessageBox.Show("Connection Successful"); form2.Show(); } }
public void connectToDBMS(ConnString cs) { DatabasesForm form2 = new DatabasesForm(cs); ConnString connect = cs; mySqlConnection = new MySqlConnection(); if (connection == false) { mySqlConnection.ConnectionString = connect.GetConStr(); mySqlConnection.Open(); connection = true; } if (connection == true) { MessageBox.Show("Connection Successful"); form2.Show(); } }
public void connectToDB(string database) { DBTablesForm form3 = new DBTablesForm(database); ConnString connect = new ConnString(); connect.SetDatabase(database); conn = new MySqlConnection(); if (connection == false) { conn.ConnectionString = connect.getConnString(); conn.Open(); connection = true; } if (connection == true) { MessageBox.Show("Connection to Database Successful"); form3.Show(); } }
public Tables(ConnString cs, string table) { conn = cs; this.table = table; }
public DatabasesForm(ConnString cs) { InitializeComponent(); conn = cs; }
public Display(ConnString cs) { conn = cs; }
public ConnectDB(ConnString cs) { conn = cs; }
public SQLForm(ConnString cs) { InitializeComponent(); conn = cs; }