private void button1_Click(object sender, EventArgs e) { dbConnection dbconn = new dbConnection(); String data_one = this.textBox1.Text; String data_two = this.textBox2.Text; String commandText = "INSERT INTO auditorium VALUES('', '" + data_one + "', '" + data_two + "')"; dbconn.insert(commandText); }
private void button1_Click(object sender, EventArgs e) { dbConnection dbc = new dbConnection(); String selectedindex1 = comboBox1.SelectedItem.ToString(); String selectedindex2 = comboBox2.SelectedItem.ToString(); String data_three = comboBox3.SelectedItem.ToString(); //String commandText = "INSERT INTO `seat` (`seat_id`, `seat_row`, `seat_number`, `auditorium_id`) VALUES (NULL, '"+ data_one + "', '" + data_two + "', '" + data_three + "')"; //dbc.insert(commandText); String connString = "Data Source=127.0.0.1;" + "Initial Catalog=movie_ticket_reservation_system;" + "User id=root;" + "Password='';"; String get_id = "SELECT * FROM moive WHERE movie_title = " + "'" + selectedindex1 + "'"; String get_id2 = "SELECT * FROM auditorium WHERE auditorium_name = " + "'" + selectedindex2 + "'"; MySqlConnection conn = new MySqlConnection(connString); MySqlCommand command = new MySqlCommand(get_id, conn); MySqlCommand command2 = new MySqlCommand(get_id2, conn); try { MySqlDataReader reader; conn.Open(); reader = command.ExecuteReader(); while (reader.Read()) { String data_one = reader["movie_id"].ToString(); conn.Close(); try { MySqlDataReader reader1; conn.Open(); reader1 = command2.ExecuteReader(); while (reader1.Read()) { String data_two = reader1["auditorium_id"].ToString(); String commandText = "INSERT INTO `screening` (`screening_id`, `movie_id`, `auditorium_id`, `screening_start`) VALUES (NULL, '" + data_one + "', '" + data_two + "', '" + data_three + "')"; dbc.insert(commandText); } } catch (Exception ex) { } } conn.Close(); Console.ReadLine(); } catch (Exception ex) { } }
private void button1_Click(object sender, EventArgs e) { String data_one = this.textBox1.Text; String data_two = this.textBox2.Text; String data_three = this.textBox3.Text; String data_four = this.textBox4.Text; String data_five = this.textBox5.Text; String commandText = "INSERT INTO `moive` (`movie_id`, `movie_title`, `movie_director`, `movie_cast`, `movie_description`, `movie_duration_min`) VALUES (NULL, '" + data_one + "', '" + data_two + "', '" + data_three + "', '" + data_four + "', '" + data_five + "')"; dbConnection dbc = new dbConnection(); dbc.insert(commandText); }
private void button1_Click(object sender, EventArgs e) { dbConnection dbc = new dbConnection(); String data_one = this.textBox1.Text; String data_two = this.textBox3.Text; String selectedindex = comboBox1.SelectedItem.ToString(); //String commandText = "INSERT INTO `seat` (`seat_id`, `seat_row`, `seat_number`, `auditorium_id`) VALUES (NULL, '"+ data_one + "', '" + data_two + "', '" + data_three + "')"; //dbc.insert(commandText); String connString = "Data Source=127.0.0.1;" + "Initial Catalog=movie_ticket_reservation_system;" + "User id=root;" + "Password='';"; String get_id = "SELECT * FROM auditorium WHERE auditorium_name = " + "'" + selectedindex + "'"; MySqlConnection conn = new MySqlConnection(connString); MySqlCommand command = new MySqlCommand(get_id, conn); Datagyi dg = new Datagyi(); try { MySqlDataReader reader; conn.Open(); reader = command.ExecuteReader(); while (reader.Read()) { String data_three = reader["auditorium_id"].ToString(); String commandText = "INSERT INTO `seat` (`seat_id`, `seat_row`, `seat_number`, `auditorium_id`) VALUES (NULL, '" + data_one + "', '" + data_two + "', '" + data_three + "')"; dbc.insert(commandText); } Console.ReadLine(); conn.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void button1_Click(object sender, EventArgs e) { String auditorium_name = this.label3.Text; String movie_title = this.label4.Text; String screening_start = this.label5.Text; String seat_number = this.comboBox1.SelectedItem.ToString(); String cost = this.textBox2.Text; String connString = "Data Source=127.0.0.1;" + "Initial Catalog=movie_ticket_reservation_system;" + "User id=root;" + "Password='';"; String get_id = "SELECT * FROM auditorium WHERE auditorium_name = " + "'" + auditorium_name + "'"; String get_id2 = "SELECT * FROM moive WHERE movie_title = " + "'" + movie_title + "'"; MySqlConnection conn = new MySqlConnection(connString); MySqlCommand command = new MySqlCommand(get_id, conn); MySqlCommand command2 = new MySqlCommand(get_id2, conn); try { MySqlDataReader reader; conn.Open(); reader = command.ExecuteReader(); while (reader.Read()) { String auditorium_id = reader["auditorium_id"].ToString(); conn.Close(); try { MySqlDataReader reader2; conn.Open(); reader2 = command2.ExecuteReader(); while (reader2.Read()) { String movie_id = reader2["movie_id"].ToString(); conn.Close(); String get_screening_id = "SELECT * FROM screening WHERE movie_id = " + "'" + movie_id + "'" + " AND auditorium_id = " + "'" + auditorium_id + "'" + "AND screening_start = " + "'" + screening_start + "'"; MySqlCommand command3 = new MySqlCommand(get_screening_id, conn); try { MySqlDataReader reader3; conn.Open(); reader3 = command3.ExecuteReader(); while (reader3.Read()) { String screening_id = reader3["screening_id"].ToString(); conn.Close(); String get_seat_id = "SELECT * FROM seat WHERE seat_number = " + "'" + seat_number + "'"; MySqlCommand command4 = new MySqlCommand(get_seat_id, conn); try { MySqlDataReader reader4; conn.Open(); reader4 = command4.ExecuteReader(); while (reader4.Read()) { String seat_id = reader4["seat_id"].ToString(); conn.Close(); dbConnection dbc = new dbConnection(); String commandText = "INSERT INTO `finalreservation` (`res_id`, `screening_id`, `seat_id`, `cost`) VALUES (NULL, '" + screening_id + "', '" + seat_id + "', '" + cost + "')"; dbc.insert(commandText); } } catch (Exception ex) { } } } catch (Exception ex) { } } } catch (Exception ex) { } } } catch (Exception ex) { } }