title: ASP.NET MVC C#: Bringing in data from multiple tables/queries into a view
body: <p>Ok, I'm still getting the hang of asp.net and the MVC framework and converting my knowledge over from classic ASP and VB - so please be gentle.</p>
  
  <p>I've got my first view (/home/details/X) functioning well <a href="https://stackoverflow.com/questions/1210413/asp-net-mvc-c-object-reference-errors-when-going-to-view-record-details">thanks to previous help pointing me in the right direction</a>, now I need to add data from multiple tables and queries/views to the MVC view (I hate that SQL and MVC both use the word view for different meanings).</p>
  
  <p>I'm not looking for someone to write the answer for me (unless they're feeling really energetic), more so for someone to point me in the right direction of what I should be looking at and reading up on to understand it and do this myself.</p>
  
  <p><strong>My problem</strong></p>
  
  <p>There are multiple datasets which I need to display in this view, and each different data set has a proper PK/FK 1-M relationship established, and the resultant records would need to be looped through.</p>
  
  <p><strong>How I would have done this previously</strong></p>
  
  <p>In my classic ASP days, I would have just defined the SQL query at the head of the page where the data was to be used, with a select statement along the lines of:</p>
  
  <pre><code>SELECT * FROM query_name
  WHERE query_uniquecolumnname = Request.QueryString("value")
  </code></pre>
  
  <p>Once that was done, you'd set the do while query_name NOT BOF/EOF up, then drop in the field names you wanted from that query and it was all done.</p>
  
  <p><strong>How do I acheive this now?</strong></p>
  
  <p>So, fast forwarding from my classic ASP knowledge, how do I acheive the same outcome with MVC?</p>
  
  <p>The tables/views I wish to use are already defined within my data model (and the relationships are showing up in there which I would assume is a plus), I just need to work out how I could call these within the page and use the ID of the record being displayed in the Details view to ensure only related data is displayed.</p>
  
  <p>Thanks in advance</p>