private void home_button_Click(object sender, EventArgs e) { Welcome_Screen Check = new Welcome_Screen(); Check.Show(); Close(); }
private void button2_Click_1(object sender, EventArgs e) { Welcome_Screen check = new Welcome_Screen(); check.Show(); Close(); }
private void dog_submit_Click(object sender, EventArgs e) { string provider = ConfigurationManager.AppSettings["provider"]; string connectionString = ConfigurationManager.AppSettings["connectionString"]; using (SqlConnection connection = new SqlConnection(connectionString)) { connection.Open(); SqlCommand cmd = new SqlCommand("INSERT INTO Doggos (Email, Name, Breed, Weight, Gender, Personality, Playfulness, Shedding, Age) VALUES " + "(@Email, @Name, @Breed, @Weight, @Gender, @Personality, @Playfulness, @Shedding, @Age)", connection); cmd.Parameters.AddWithValue("@Email", mail); cmd.Parameters.AddWithValue("@Name", name_text.Text); cmd.Parameters.AddWithValue("@Breed", breed_combo.SelectedItem.ToString()); cmd.Parameters.AddWithValue("@Weight", weight_combo.SelectedItem.ToString()); cmd.Parameters.AddWithValue("@Gender", gender_combo.SelectedItem.ToString()); cmd.Parameters.AddWithValue("@Personality", personality_combo.SelectedItem.ToString()); cmd.Parameters.AddWithValue("@Playfulness", playfulness_combo.SelectedItem.ToString()); cmd.Parameters.AddWithValue("@Shedding", shedding_combo.SelectedItem.ToString()); cmd.Parameters.AddWithValue("@Age", age_combo.SelectedItem.ToString()); try { cmd.ExecuteNonQuery(); } catch (SqlException sqlEX) { MessageBox.Show(sqlEX.Message); } connection.Close(); } Welcome_Screen check = new Welcome_Screen(); check.Show(); Close(); //Intermediate_page Check = new Intermediate_page(mail); //Check.Show(); }
private void button2_Click(object sender, EventArgs e) { DataTable lizard = new DataTable(); String Breed = null; String Age = null; String Gender = null; String Personality = null; if (comboBox1.SelectedItem == null) { Breed = "Breed IS NOT NULL"; } else { Breed = "Breed = '" + comboBox1.SelectedItem.ToString() + "'"; MessageBox.Show(Breed); } if (comboBox2.SelectedItem == null) { Age = "Age IS NOT NULL"; } else { Age = "Age = '" + comboBox2.SelectedItem.ToString() + "'"; MessageBox.Show(Age); } if (comboBox3.SelectedItem == null) { Gender = "Gender IS NOT NULL"; } else { Gender = "Gender = '" + comboBox3.SelectedItem.ToString() + "'"; MessageBox.Show(Gender); } if (comboBox4.SelectedItem == null) { Personality = "Personality IS NOT NULL"; } else { Personality = "Personality = '" + comboBox4.SelectedItem.ToString() + "'"; MessageBox.Show(Personality); } string provider = ConfigurationManager.AppSettings["provider"]; string connectionString = ConfigurationManager.AppSettings["connectionString"]; using (SqlConnection connection = new SqlConnection(connectionString)) { using (SqlDataAdapter adapter = new SqlDataAdapter("SELECT * FROM LIZARD Where " + Breed + " AND " + Age + " AND " + Gender + " AND " + Personality, connection)) { try { adapter.Fill(lizard); } catch (SqlException sqlerror) { MessageBox.Show(sqlerror.ToString()); } } foreach (DataRow row in lizard.Rows) { Lizard_results Check = new Lizard_results(row["Name"].ToString(), row["Breed"].ToString(), row["Age"].ToString(), row["Gender"].ToString(), row["Weight"].ToString(), row["Personality"].ToString(), row["Email"].ToString(), this); Check.ShowDialog(); } Welcome_Screen Check2 = new Welcome_Screen(); Check2.Show(); } }