private void btnLogin_Click(object sender, EventArgs e) { try { connectn = new SqlConnection(con); //SqlCommand cmd = new SqlCommand("Select * from Profile_Master where Pro_Name='"+ textBox2.Text +"' and Pro_Password='******'", connectn); SqlDataAdapter sda = new SqlDataAdapter("Select * from Profile_Master where Pro_Name='" + textBox2.Text + "' and Pro_Password='******'", connectn); DataTable dt = new DataTable(); sda.Fill(dt); if (dt.Rows.Count == 1) { LMS obj = new LMS(); obj.Show(); } else { MessageBox.Show("Invalid UserName and Password", "Alert", MessageBoxButtons.OK, MessageBoxIcon.Error); textBox1.Text = ""; textBox2.Text = ""; } } catch (Exception ex) { } finally { connectn.Close(); } }
private void button2_Click(object sender, EventArgs e) { Connection con = new Connection(); SqlDataAdapter sda = new SqlDataAdapter("Select * From Profile_Master Where Pro_User_Id='" + textBox1.Text + "' and Pro_Password= '******'", con.Activecon()); DataTable dt = new DataTable(); sda.Fill(dt); if (dt.Rows.Count == 1) { LMS obj = new LMS(); obj.Show(); this.Hide(); } else { MessageBox.Show("Invalid User Name or Password....!!", "Aleart", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void button2_Click(object sender, EventArgs e) { Connection connect = new Connection(); SqlDataAdapter sda = new SqlDataAdapter("select * from profile_master where pro_user_id = '" + textBox1.Text + "' and pro_password = '******' ", connect.activecon()); DataTable dt = new DataTable(); sda.Fill(dt); if (dt.Rows.Count == 1) { LMS lms_temp = new LMS(); lms_temp.Show(); this.Hide(); } else { MessageBox.Show("UserName or password is incorret", "Login Message", MessageBoxButtons.OK, MessageBoxIcon.Error); } }