multiple from recordsets SQL->C# app

I have a SQL stored proc that returns multiple recordsets from multiple queries. When I run it in SQL Mgmt Studio, it works great. Currently I get back 3 tables with a few dozen records in each. Correct results.

When I call this from C# code, using SqlAdapter.Fill() into a DataSet, I do indeed get 3 tables in my DataSet. It's just that they're totally empty.

I'm using the same parameters in each call.

So let me just ask this, right off the bat: Is reading these multiple recordsets into a DataSet not going to ever return results? If it should be working, is there perhaps a known wrinkle regarding multiple recordsets somewhere that I'm missing?

Can't speak to the C# aspects of this quesion, but a common T-SQL reason is that if there are any messages that appear in your SSMS that are not sets, such as '(123 rows updated)', that a calling application

Can't speak to the C# aspects of this quesion, but a common T-SQL reason is that if there are any messages that appear in your SSMS that are not sets, such as '(123 rows updated)', that a calling application like C# will interpret as an empty set.

To prevent this from happening you'll have to execute statements such as SET NOCOUNT ON, SET ANSI_WARNINGS OFF, etc. in your T-SQL code before executing the code that returns the sets.

You may also want to consider changing your design so that multiple sets are not called by a single C# data set.

You can test Jim's theory by only returning 1 dataset from your stored procedure and see if it works. If it doesn't, then the issue is not with multiple datasets, but something else, like not setting SET NOCOUNT ON in your stored procedure.

Having an SQL database can be a big investment for a small company. Hardware, setup and of course, the price of software all add up to a big bill that some companies may not be able to absorb. Luckily, there is a free version SQL Express, but does …

Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables.
Make a table:
Update a specific column given a specific row using the UPDATE statement:
Remove a set of values using the DELETE s…