public string GetRolesByUserId(int userId) { StringBuilder sb = new StringBuilder(); DataTable dataTable = dal.GetRolesByUserId(userId); foreach (DataRow dr in dataTable.Rows) { sb.Append(dr["RoleId"].ToString() + ","); } return(sb.ToString().TrimEnd(',')); }