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();
                }




            }
tpunt commented: Useless thread - Where's the question? +0

Wrong category and no explanation..?

... and the question is?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.