예제 #1
0
        private void button5_Click(object sender, EventArgs e)
        {
            userForm   us  = new userForm();
            SqlCommand cmd = new SqlCommand("insert into wedding_info (wed_planner_idd,location_id,foodagency_id,wedding_date,user_idd) values('" + textBox1.Text + "','" + textBox2.Text + "','" + textBox3.Text + "', '" + user_date.Text + "','" + idd + "') ", cn);

            cn.Open();
            cmd.ExecuteNonQuery();
            MessageBox.Show("selections have been added to your wedding table");
            cn.Close();
        }
예제 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            SqlConnection  cn = new SqlConnection("Data Source =DESKTOP-74I7G65\\SQLEXPRESS; Initial Catalog=Weddingguide;Integrated Security = True ");
            SqlDataAdapter da;
            DataTable      dt = new DataTable();

            if (comboBox1.Text == admin)
            {
                da = new SqlDataAdapter("Select* from Admin where admin_name ='" + textBox1.Text + "'and admin_pass = '******'", cn);
                da.Fill(dt);
                if (dt.Rows.Count == 1)
                {
                    adminForm f = new adminForm();
                    this.Hide();
                    f.Show();
                }
                else
                {
                    MessageBox.Show("Incorrect username and password ", "Erorr", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else if (comboBox1.Text == user)
            {
                da = new SqlDataAdapter("Select* from [User] where user_name ='" + textBox1.Text + "'and user_pass = '******'", cn);
                da.Fill(dt);
                if (dt.Rows.Count == 1)
                {
                    userForm f = new userForm(dt.Rows[0]["user_name"].ToString(), Convert.ToInt32(dt.Rows[0]["user_id"]));

                    this.Hide();
                    f.Show();
                }
                else
                {
                    MessageBox.Show("Incorrect username and password ", "Erorr", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else if (comboBox1.Text == WeddingP)
            {
                da = new SqlDataAdapter("Select* from [wedding planner] where wed_planner_name ='" + textBox1.Text + "'and wedding_planner_pass = '******'", cn);
                da.Fill(dt);
                if (dt.Rows.Count == 1)
                {
                    plannerForm f = new plannerForm(dt.Rows[0]["wed_planner_name"].ToString(), Convert.ToInt32(dt.Rows[0]["wed_planner_id"]));

                    this.Hide();
                    f.Show();
                }
                else
                {
                    MessageBox.Show("Incorrect username and password ", "Erorr", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }