Beispiel #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            Form1_DESK f = new Form1_DESK();

            f.Show();
            this.Hide();
        }
        public void login2()
        {
            connect1();
            OracleCommand cm = new OracleCommand();
            string        us, pw;

            us             = textBox1.Text;
            pw             = textBox2.Text;
            cm.Connection  = conn;
            cm.CommandText = "select * from desk";
            cm.CommandType = CommandType.Text;
            OracleDataAdapter da = new OracleDataAdapter(cm.CommandText, conn);
            DataSet           ds = new DataSet();

            da.Fill(ds, "desk");
            DataTable dt = ds.Tables["desk"];
            // int tr = dt.Rows.Count;
            DataRow dr;
            int     i = 0, flag = 0;

            while (i < dt.Rows.Count)
            {
                dr = dt.Rows[i];
                if (us == dr["usn"].ToString())
                {
                    flag = 1;
                    if (pw == dr["pwd"].ToString())
                    {
                        MessageBox.Show("WELCOME " + dr["name"].ToString());
                        string     nam = dr["name"].ToString();
                        Form1_DESK f2  = new Form1_DESK();
                        f2.Show();
                        this.Hide();
                        break;
                    }
                    else
                    {
                        MessageBox.Show("WRONG PASSWORD");
                    }
                }
                i++;
            }
            if (flag == 0)
            {
                MessageBox.Show("USERNAME NOT FOUND");
            }
        }