Note that there are some explanatory texts on larger screens.

plurals
  1. POUnable to pull fields from within LINQ query
    primarykey
    data
    text
    <p>Quick overview:<br /> Visual Basic 2010 WinForm app pulls data from DB2. The app allows users to filter the data.</p> <p>The problem:<br /> I'm doing something wrong with my LINQ query (or object definition), as I'm not able to access fields within the dataset. Pulling data from DB2 is fine, I get that data and store it as an IEnumerable.</p> <p>I plan to run this app as disconnected since its readonly for 95% of the users and it accesses 100,000+ records. Because of this, I have two datasets: 1) 'data' which is the full dataset pulled from DB2 (I don't plan on doing any modifications to it), (2) 'filteredData' which is a subset of data based on user entered filters.</p> <pre><code>Dim data As IEnumerable Dim dataFiltered = From record in data Select record 'Filter data based on version Select case uxCodeVersion.Text Case "10" dataFiltered = From rec in dataFiltered Where rec. ... (other parts of case statement removed) End Select </code></pre> <p>and this is my problem. I'm expecting to see the list of fields within 'rec.' (such as rec.CodeVersion) ;however, I just receive object methods (Equals, GetHashCode, GetType, ReferenceEquals, ToString).</p> <p>What simple thing am I missing?</p> <p>Performance is an issue too, but I figured one problem at a time...</p> <p>Thank you,<br /> Brian. <br /></p> <p>Here is the answer as provided below.</p> <p>When defining data, I need to define it to the generic list DTO. So in my case, that becomes: <br /></p> <pre><code> Dim data As IEnumerable(Of DataAccessLayer.DiagnosisAndDiagnosisIndustryCombinedDTO) </code></pre> <p>Then when accessing the code, its the same as before, though I temporarily took out the dataFiltered field and just used data.</p> <pre><code>dataFiltered = From rec in data Where rec.CodeVersion = uxCodeVersion.Text </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload