C# visual if/else issue
Hi having abit of a problem with my code it refuses to do my else statement have a global variable set to say attempts = 3

runs the while loop but when i put an invalid pin it basically just doesnt run anything i would appreciate any help possible thanks

                while (read.Read())
                {
                    if (read.HasRows)
                {
                }
                    //If the card isnt confiscated then do this:
                    if (((Boolean)(read["confiscated"]) == false))
                    {
                        string cardnum = read["cardNumber"].ToString();
                        string pinnum = read["PIN"].ToString();


                        //Compare the results in the table against those put in by the customer
                        if (string.Equals(cardnum, cardBox.Text) && string.Equals(pinnum, pinNumber.Text))
                        {
                            MessageBox.Show("Welcome customer");
                            MessageBox.Show("Card Number " + cardnum + " PIN " + pinnum);
                            //if the login details match and everything is correct then bring the next form up
                            MessageBox.Show("Details are correct");
                            pinNumber.Clear();
                            //open the options form
                            Form optionForm = new optionForm();
                            optionForm.Show();
                            //hide this form
                            this.Hide();
                            break;
                            
                        }
                        else
                        {
                            if (attempts == 1)
                            {
                                sqlCommandATM.Parameters["@cardNum"].Value = cardBox.Text;
                                sqlCommandATM.Parameters["@confiscated"].Value = true;
                                MessageBox.Show("Your card has been confiscated please contact The bank of Glamorgan to resolve the issue");
                                pinNumber.Clear();

                            }
C# visual if/else issue
===

Hi having abit of a problem with my code it refuses to do my else statement have a global variable set to say attempts = 3

runs the while loop but when i put an invalid pin it basically just doesnt run anything i would appreciate any help possible thanks

                while (read.Read())
                {
                    if (read.HasRows)
                {
                }
                    //If the card isnt confiscated then do this:
                    if (((Boolean)(read["confiscated"]) == false))
                    {
                        string cardnum = read["cardNumber"].ToString();
                        string pinnum = read["PIN"].ToString();


                        //Compare the results in the table against those put in by the customer
                        if (string.Equals(cardnum, cardBox.Text) && string.Equals(pinnum, pinNumber.Text))
                        {
                            MessageBox.Show("Welcome customer");
                            MessageBox.Show("Card Number " + cardnum + " PIN " + pinnum);
                            //if the login details match and everything is correct then bring the next form up
                            MessageBox.Show("Details are correct");
                            pinNumber.Clear();
                            //open the options form
                            Form optionForm = new optionForm();
                            optionForm.Show();
                            //hide this form
                            this.Hide();
                            break;
                            
                        }
                        else
                        {
                            if (attempts == 1)
                            {
                                sqlCommandATM.Parameters["@cardNum"].Value = cardBox.Text;
                                sqlCommandATM.Parameters["@confiscated"].Value = true;
                                MessageBox.Show("Your card has been confiscated please contact The bank of Glamorgan to resolve the issue");
                                pinNumber.Clear();

                            }