private void button4_Click(object sender, EventArgs e)
        {
            try
            {
                SqlCommand cmd = new SqlCommand("removeperson", con);

                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.AddWithValue("@Person", textBox9.Text);

                con.Open();
                try
                {
                    cmd.ExecuteNonQuery();
                }
                catch (Exception ex)
                {
                    MessageBox.Show("                    <<<INVALID SQL OPERATION>>> \n" + ex);
                }
                con.Close();
                MessageBox.Show("Deletion Complete");
                Form1   obj  = new Form1();
                Appbody obj1 = new Appbody();
                obj1.Hide();
                obj.Show();
            }

            catch (Exception ex)
            {
                MessageBox.Show("" + ex);
            }
        }
        private void getdata()
        {
            string name = textBox1.Text;
            string pass = textBox2.Text;
            string adu  = "admin";

            da = new SqlDataAdapter("Select UserName FROM Person WHERE UserName like'" + textBox1.Text + "' and Password='******' ", con);
            DataTable dt = new DataTable();

            da.Fill(dt);
            if (dt.Rows.Count == 1)
            {
                label5.Hide();
                MessageBox.Show("Log in success");
                Appbody obj = new Appbody();
                this.Hide();
                obj.Show();
            }

            else if (name.Equals(adu) && pass.Equals(adu))
            {
                label5.Hide();
                MessageBox.Show("Successfully logged in as admin");
                admin obj = new admin();
                this.Hide();
                obj.Show();
            }
            else
            {
                label5.Show();
            }
        }
Esempio n. 3
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         connect obj = new connect();
         obj.con.ConnectionString = obj.locate;
         obj.con.Open();
         string insert = "insert into Person values('" + textBox1.Text + "','" + textBox2.Text + "','" + textBox3.Text + "','" + textBox4.Text + "','" + textBox5.Text + "','" + textBox9.Text + "','" + textBox8.Text + "','" + textBox7.Text + "','" + textBox6.Text + "','" + textBox10.Text + "')";
         obj.cmd.Connection  = obj.con;
         obj.cmd.CommandText = insert;
         obj.cmd.ExecuteNonQuery();
         obj.con.Close();
         MessageBox.Show("Sign up Completed");
         this.Hide();
         Appbody obj1 = new Appbody();
         obj1.Show();
     }
     catch (Exception ex)
     {
         MessageBox.Show("Error" + ex);
     }
 }