示例#1
0
        public void SelectTable()
        {
            MySqlConnection connection = new MySqlConnection(conn.GetConStr());

            connection.Open();
            bool connect = true;

            if (connect == true)
            {
                ViewTableForm veiwTable = new ViewTableForm(conn, table);
                veiwTable.Show();
            }
        }
示例#2
0
        //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();
            }
        }
示例#3
0
 private void insertButton_Click(object sender, EventArgs e)
 {
     try
     {
         MySqlConnection connection = new MySqlConnection(conn.GetConStr());
         connection.Open();
         MySqlCommand cmd = connection.CreateCommand();
         cmd.CommandText = "INSERT INTO  " + table + " VALUES(" + GetInsertQueryString() + ");";
         cmd.ExecuteNonQuery();
         ViewTableForm tableForm = new ViewTableForm(conn, table);
         tableForm.Show();
         this.Close();
     }
     catch
     {
         MessageBox.Show("Invalid Entries");
     }
 }