-1
 private void cmdlogsec_Click(object sender, EventArgs e)
        {

            try
            {
                string myConnection = "datasource=localhost; database=secretary; port=3306; username=root; password=palo";
                MySqlConnection myConn = new MySqlConnection(myConnection);

                myConn.Open();

                string userText = txtusersec.Text;
                string passText = txtpasssec.Text;
                MySqlCommand selectcomand = new MySqlCommand("select username,password from secretary.tblseclog where username=' " + this.txtusersec.Text + "' and password ='" + this.txtpasssec.Text + "' ", myConn);
                MySqlDataAdapter myDataAdapter = new MySqlDataAdapter(selectcomand);
                DataTable dt = new DataTable();
                myDataAdapter.Fill(dt);

                if (dt.Rows.Count > 0)
                {
                    MessageBox.Show("Login Sucess!!");
                    selectcomand = new MySqlCommand("select username,password from secretary.tblseclog where username=' " + this.txtusersec.Text + "' and password ='" + this.txtpasssec.Text + "' ", myConn);
                    selectcomand.Parameters.AddWithValue("@username", userText);
                    selectcomand.Parameters.AddWithValue("@password", passText);

                    MySqlDataReader myreader;

                    myreader = selectcomand.ExecuteReader();

                    Form5 myForm5 = new Form5();
                    myForm5.Show();


                    this.Hide();

                }
                else
                {
                    MessageBox.Show("Access Denied!!");
                    myConn.Close();
                }




            }

Edited by happygeek: moved

Votes + Comments
Useless thread - Where's the question?
3
Contributors
2
Replies
15
Views
4 Years
Discussion Span
Last Post by <M/>
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.