public static InterestedIns GetDistinctInterests() { InterestedIns iterests = null; // get a configured DbCommand object DbCommand comm = DbAct.CreateCommand(); // set the stored procedure name comm.CommandText = "up_GetDistinctInterests"; // execute the stored procedure DataTable dt = DbAct.ExecuteSelectCommand(comm); // was something returned? if (dt != null && dt.Rows.Count > 0) { iterests = new InterestedIns(); iterests.AddRange(dt.Rows.Cast<DataRow>() .Select(dr => new InterestedIn( FromObj.IntFromObj(dr["interestedInID"]))) .Where(iterest => iterest.InterestedInID != 0)); } return iterests; }