コード例 #1
0
ファイル: Login.cs プロジェクト: UsmanFayyaz/code
        private void button1_Click(object sender, EventArgs e)
        {
            SqlConnection myConnection = Backend.Connection;
            SqlCommand    myCommand    = new SqlCommand("SELECT * FROM Customer WHERE Cust_ID='" + textBox1.Text + "'", myConnection);
            SqlDataReader myReader     = myCommand.ExecuteReader();

            if (myReader.Read())
            {
                if (textBox2.Text.Equals(myReader["PIN"].ToString()))
                {
                    customerID = myReader["Cust_ID"].ToString();
                    MessageBox.Show("Success");
                    AccountList al = new AccountList();
                    myReader.Close();
                    al.Show();
                }
                else
                {
                    MessageBox.Show("Sorry, incorrect PIN.");
                }
            }
            else
            {
                MessageBox.Show("Customer does not exist");
            }
            myReader.Close();
        }
コード例 #2
0
ファイル: Login.cs プロジェクト: anuragbhd/code
 private void button1_Click(object sender, EventArgs e)
 {
     SqlConnection myConnection = Backend.Connection;
     SqlCommand myCommand = new SqlCommand("SELECT * FROM Customer WHERE Cust_ID='" + textBox1.Text + "'", myConnection);
     SqlDataReader myReader = myCommand.ExecuteReader();
     if (myReader.Read())
     {
         if (textBox2.Text.Equals(myReader["PIN"].ToString()))
         {
             customerID = myReader["Cust_ID"].ToString();
             MessageBox.Show("Success");
             AccountList al = new AccountList();
             myReader.Close();
             al.Show();
         }
         else
             MessageBox.Show("Sorry, incorrect PIN.");
     }
     else
     {
         MessageBox.Show("Customer does not exist");
     }
     myReader.Close();
 }