title: SSRS 2008 Wont return the correct Dataset from Stored Procedure
body: <p>I've got a Procedure which has multiple Query's which run depending on which Parameters are used.</p>
  
  <pre><code>If Reportname = 'Foo'
  Begin
  Select Forename, Surname, Jobtitle, Gender from Staff where X = y
  End
  
  If ReportName = 'Bar'
  Begin
  Select EnrolmentID, StudentID, EnrolmentStartDate, EnrollmentExpectedEndDate, Status  from Enrolment where y = Z
  End
  </code></pre>
  
  <p>If I run this in SSMS it returns the correct records and columns. 
  Where as in SSRS when I select the Procedure and set up the parameters, it defines the available columns as those contained within the first Select Statement of the Procedure.</p>
  
  <p>This procedure is going to be used for various different reports and for backend processing, I ideally don't want to double up the code. </p>
  
  <p>Has anyone got any recommendations on how to get SSRS to detect the correct context that's being applied?</p>
  
  <p>I know I can alter some of the core logic to be in a table valued function which returns some universal data which applies to all circumstances. </p>
  
  <p>Thanks</p>
  
  <p>Also does anyone have tips on convincing my bosses to upgrade from ADO Classic to ADO.Net Entity Framework? I miss the flexibility of EF especially as we do everything in stored procedures, including returning single values which drives me mad.</p>