I am calling a stored procedure using a text query for the dataset using the following syntax:
exec Database..StoredProcedure ?, ? , ?, ?, 1, 2, 1
The dataset is using an ODBC data source for Sybase. Using the syntax above works. However, if I change out the second-to-last parameter (2) for a variable (?) and populate that with a reference to an integer report parameter, the report errs out on save.
exec Database..StoredProcedure ?, ? , ?, ?, 1, ?, 1
error: Could not update a list of fields for the query. Verify that you can connect to the data source and that your query syntax is correct.
This particular parameter does affect the number and definition of the fields that are output by the stored procedure. Ideally I would like to have this dynamic so that all of the variations of this parameter that return the same fields could be called from the same dataset.
The way I got this to work was as follows:
1) Add the QueryParameter into the XML for the report manually.
2) Modify the SQL Query for the dataset in the XML manually.
After these modification it worked.