Пример #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            this.Hide();
            app3dio app = new app3dio();

            app.ShowDialog();
        }
Пример #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            SqlConnection conn = new SqlConnection(ConnectionString);
            SqlCommand    cmd  = new SqlCommand("select count (*) as cnt from Table2 where username=@usr and password=@pwd", conn);

            cmd.Parameters.Clear();
            cmd.Parameters.AddWithValue("@usr", textBox1.Text);
            cmd.Parameters.AddWithValue("@pwd", textBox2.Text);
            conn.Open();

            if (cmd.ExecuteScalar().ToString() == "1")
            {
                MessageBox.Show("Login Successfull");
                this.Hide();
                app3dio app = new app3dio();
                app.ShowDialog();
            }
            else
            {
                MessageBox.Show("User name or password are not correct");
                textBox1.Clear();
                textBox2.Clear();
            }
            conn.Close();
        }