Beispiel #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            addfeed();
            this.Hide();
            studenthome ob = new studenthome();

            ob.Show();
        }
        private void button1_Click(object sender, EventArgs e)
        {
            con.Open();
            cmd.Connection  = con;
            cmd.CommandText = "select rid from tbl_login where email = '" + textBox1.Text + "' and password = '******'";
            cmd.CommandType = CommandType.Text;
            SqlDataReader rd = cmd.ExecuteReader();

            if (rd.Read())
            {
                id = rd[0].ToString();
                con.Close();
                con.Open();
                cmd.Connection  = con;
                cmd.CommandText = "select name from tbl_reg where rid = @id";
                cmd.CommandType = CommandType.Text;
                cmd.Parameters.AddWithValue("@id", id);
                SqlDataReader rd1 = cmd.ExecuteReader();
                cmd.Parameters.Clear();
                if (rd1.Read())
                {
                    name = rd1[0].ToString();
                    con.Close();
                }
                else
                {
                    MessageBox.Show("Something went wrong !", "Error");
                    con.Close();
                }
                studenthome ob = new studenthome(name, id);
                this.Hide();
                ob.Show();
            }
            else
            {
                MessageBox.Show("The email or password entered is incorrect", "Login Failed");
                con.Close();
            }
        }