コード例 #1
0
        private void Button2_Click(object sender, EventArgs e)
        {
            this.Hide();



            faculty f = new faculty();

            f.Show();
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: sharif7761/DotNet
        } //SELECT id_employee FROM employee WHERE employee_number= @txtUserName AND passWord= @txtPassword";

        //"select count(*) from data1 where username ='******' and password='******'" , sql

        private void Button1_Click(object sender, EventArgs e)
        {
            SqlConnection  sql = new SqlConnection(@"Data Source = (LocalDB)\MSSQLLocalDB; AttachDbFilename = C:\Users\SHAHID AFRIDI ZIHAD\Documents\data.mdf; Integrated Security = True; Connect Timeout = 30");
            SqlDataAdapter sda = new SqlDataAdapter("select type from UserData where username ='******' and password='******'", sql);
            DataTable      dt  = new DataTable();

            sda.Fill(dt);
            if (dt.Rows.Count == 1)
            {
                this.Hide();
                if (dt.Rows[0][0].ToString() == "Student")
                {
                    Student s = new Student();
                    s.Show();
                }

                if (dt.Rows[0][0].ToString() == "Faculty")
                {
                    faculty f = new faculty();
                    f.Show();
                }

                if (dt.Rows[0][0].ToString() == "Admin")
                {
                    Home1 hm = new Home1();
                    hm.Show();
                }
            }



            else
            {
                MessageBox.Show("Invalid user name or password");
            }
        }