Exemplo n.º 1
0
        private void button2_Click(object sender, EventArgs e)
        {
            this.Hide();
            WelcomeWindow w = new WelcomeWindow(ID);

            w.Show();
        }
Exemplo n.º 2
0
        private void loginButton_Click(object sender, EventArgs e)
        {
            //Initiating SQL Connection:
            SqlConnection con = new SqlConnection("data source = DESKTOP-QPUU33H;" +
                                                  "database = Library;" +
                                                  "integrated security = true");

            SqlDataAdapter sda = new SqlDataAdapter("Select * from UserLogin where UserID ='" + getId.Text.ToString() + "'and Password ='******'", con);
            DataTable      DT  = new DataTable();

            sda.Fill(DT);

            if (DT.Rows.Count > 0)
            {
                WelcomeWindow firstWindow = new WelcomeWindow(getId.Text.ToString());
                firstWindow.Show();
                this.Hide();
            }
            else
            {
                MessageBox.Show("Invalid user name and password.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }