Many times when creating an SSRS report I get the message “Could not generate a list of fields for the query” especially when using datasources which include temporary tables or very complex queries.  Sometimes clicking the Refresh fields button on the query toolbar does indeed fix the issue and other times it does not help.

I found the workaround for making it always work.

  1. Close the design view of the report
  2. Right-click the report and choose View code
  3. Find the end of the SQL query that is giving you the error message…you can search for if you want.
  4. Add the area with any  report parameters which this data source uses.
  5. Save
  6. Close
  7. Reopen the report in design view