예제 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            cmd.CommandText = "Select COUNT(1) from LOGIN where CUSTOMEREMAIL='" + Email.Text + "' AND CUSTOMERPASSWORD='******' ";
            /*For UPDATE, INSERT, and DELETE statements, the return value is the number
            of rows affected by the command.
            When a trigger exists on a table being inserted or updated,
            the return value includes the number of rows affected by both
            the insert or update operation and the number of rows affected
            by the trigger or triggers. For all other types of statements,
            the return value is -1. If a rollback occurs, the return value is also -1.
            http://forums.asp.net/post/4775075.aspx */

            //At least one row exists
            if (Convert.ToInt32(cmd.ExecuteScalar()) != 0)
            {
                cmd.CommandText = "Select CUSTOMERNUMBER from LOGIN where CUSTOMEREMAIL='" + Email.Text + "' ";

                OracleDataReader reader = cmd.ExecuteReader();
                reader.Read();
                oraAPP.SetGlobalVar(int.Parse(reader["CUSTOMERNUMBER"].ToString()));

                 MessageBox.Show("Successfully logged in!");
                Home form_h = new Home();
                form_h.Show();
                this.Hide();
            }
            //No rows exists
            else
                MessageBox.Show("Unsuccessful login attempt");
        }
예제 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {

                cmd.CommandText = "Insert into CUSTOMER values (" + randomCustomerNumber + " ,'" + CustomerName.Text + "','" + CustomerPhone.Text + "')";
                int rowsUpdated1 = cmd.ExecuteNonQuery();
                if (rowsUpdated1 == 0)
                {
                    MessageBox.Show("Record not inserted");
                }
                else

                cmd.CommandText = "Insert into LOGIN values (" + randomCustomerNumber + " ,'" + CustomerEmail.Text + "','" + CustomerPassword1.Text + "')";
                int rowsUpdated2 = cmd.ExecuteNonQuery();
                if (rowsUpdated2 == 0)
                {
                    MessageBox.Show("Record not inserted");
                }
                else

                cmd.CommandText = "Insert into Address values (" + randomCustomerNumber + " ,'" + AddressLine1.Text + "','" + AddressLine2.Text + "','" + City.Text + "','" + State.Text + "','" + Landmark.Text + "','" + Country.Text + "','" + ZipCode.Text + "')";

                int rowsUpdated3 = cmd.ExecuteNonQuery();
                if (rowsUpdated3 == 0)
                {
                    MessageBox.Show("Record not inserted");
                }
                else {
                MessageBox.Show("Successfully Registered!");
                    Home home_f = new Home();
                    home_f.Show();
                    this.Hide();
                     }
                conn.Dispose();

            }
            catch (Exception F)
            {
                MessageBox.Show(F.ToString());
            }
        }
예제 #3
0
 private void button3_Click(object sender, EventArgs e)
 {
     Home form_h = new Home();
     form_h.Show();
     this.Hide();
 }