示例#1
0
        private void button1_Click(object sender, EventArgs e)
        {
            String        username = bunifuMaterialTextbox1.Text.Trim();
            String        pass     = bunifuMaterialTextbox3.Text.Trim();
            SqlConnection con      = new SqlConnection(@"Data Source=DESKTOP-UPGUJCC\ROHANSQL;Initial Catalog=CRMERP;Integrated Security=True");
            string        q        = "Select * from LoginMaster where Username='******' and Password='******'";

            con.Open();
            SqlCommand    cmd = new SqlCommand(q, con);
            SqlDataReader r   = cmd.ExecuteReader();

            decimal id;

            if (r.HasRows)
            {
                while (r.Read())
                {
                    name = r["EmpName"].ToString();
                    id   = (decimal)r["EmpID"];
                }
                this.Hide();
                home h = new home();
                h.Closed += (s, args) => this.Close();
                h.Show();
            }

            else
            {
                MessageBox.Show("Invalid Username or Password");
            }
            con.Close();
        }
示例#2
0
        private void button1_Click(object sender, EventArgs e)
        {
            this.Hide();
            home h = new home();

            h.Closed += (s, args) => this.Close();
            h.Show();
        }