Exemple #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                conn.sqlConnection1.Open();
                SqlCommand    cmd = new SqlCommand("select userid,password from users where userid='" + textBox1.Text + "'" + "and password='******'", conn.sqlConnection1);
                SqlDataReader dr  = cmd.ExecuteReader();
                if (dr.Read())
                {
                    this.Hide();
                    from2 f2 = new from2();
                    f2.ShowDialog();
                    this.Close();
                    conn.sqlConnection1.Close();
                }


                else
                {
                    MessageBox.Show("Invalid User ID or Password");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error" + ex.Message);
            }

            finally {
                conn.sqlConnection1.Close();
            }
        }
Exemple #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            this.Hide();
            from2 f2 = new from2();

            f2.ShowDialog();
            this.Close();
        }