public static bool Login(string username, string password) { using (SqlConnection conn = DBConnection.GetConnection()) { conn.Open(); string sql = "select count(*) from Emplopyee where Username='******' and Password='******' and status = 'Active'"; SqlCommand com = new SqlCommand(sql, conn); SqlDataAdapter dataAdapter = new SqlDataAdapter(com); DataTable dt = new DataTable(); dataAdapter.Fill(dt); conn.Close(); if (dt.Rows[0][0].ToString().Equals("1")) { return(true); } return(false); } }