April 8, 2013 at 11:10 am
I have a report that gets its data from a stored procedure.
I have the NoRowsMessage property set to display my custom message but I still see the 'Invalid attempt to read when no data present' message.
Is there something special you need to do when using stored procedures? I can get it to work from a simple query with no data...
Thanks for all suggestions.
April 9, 2013 at 8:45 am
I've never seen this error when using a stored procedure. I've never had an issue with the no rows message not being used when a stored procedure doesn't return data.
Does the report work when the stored procedure does return data?
Can you run a trace when you run the report with a parameter combination does not return data and see what is happening on the SQL Server?
What happens when you run the stored procedure directly with the parameter combination that doesn't return data?
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
April 10, 2013 at 8:10 am
I got it working.
The proc uses dynamic sql based on parameter values from the report. SQL gets stored in a variable and then that sql is executed.
I modified the dynamic sql to insert the data into a global temp table and return the result set from that table.
This works great.
Running it in SSMS without the temp table resulted in the 'Commad completed successfully' message.
Running it in SSMS with the temp table gives me column headers with no rows. I guess that's the only way the report can understand there is no data where essentially the 'Commad completed successfully' message constitutes data?
Not sure but it is working so...
April 10, 2013 at 8:16 am
Without seeing the code, it's hard to say what is really happening.
What are you doing to mitigate against the risk of SQL Injection in the dynamic SQL?
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
April 10, 2013 at 9:16 am
The parameters are drop down lists populated by 2 seperate datasets that the user cannot edit.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply