示例#1
0
        private void btnCustLogin_Click(object sender, EventArgs e)
        {
            AirAsianDataBase.Close();


            string           strSelect = "Select * from Customer Where [FullName] = @custName";
            OleDbDataAdapter da        = new OleDbDataAdapter(strSelect, AirAsianDataBase);

            da.SelectCommand.Parameters.AddWithValue("@custName", txtCustName.Text);
            OleDbCommandBuilder cBuilder = new OleDbCommandBuilder(da);

            DataTable dataTable = new DataTable();

            da.Fill(dataTable);
            if (dataTable.Rows.Count > 0)
            {
                MessageBox.Show("Welcome " + txtCustName.Text + " !");
                this.Hide();
                ReserveMenu r = new ReserveMenu(txtCustName.Text);
                //ReserveMenu r = new ReserveMenu(theCust);  actually should use this one
                r.ShowDialog();
            }
            else
            {
                MessageBox.Show("Login Fail, please try again!");
            }

            AirAsianDataBase.Close();
        }
        private void btnCustLogin_Click(object sender, EventArgs e)
        {
            AirAsianDataBase.Close();

            string strSelect = "Select * from Customer Where [FullName] = @custName";
            OleDbDataAdapter da = new OleDbDataAdapter(strSelect, AirAsianDataBase);
            da.SelectCommand.Parameters.AddWithValue("@custName", txtCustName.Text);
            OleDbCommandBuilder cBuilder = new OleDbCommandBuilder(da);

            DataTable dataTable = new DataTable();

            da.Fill(dataTable);
            if (dataTable.Rows.Count > 0)
            {
                MessageBox.Show("Welcome " + txtCustName.Text + " !");
                this.Hide();
                ReserveMenu r = new ReserveMenu(txtCustName.Text);
                //ReserveMenu r = new ReserveMenu(theCust);  actually should use this one
                r.ShowDialog();
            }
            else MessageBox.Show("Login Fail, please try again!");

            AirAsianDataBase.Close();
        }