Reputation: 6050
I know in .net datasets you can give names to the tables. Is there anyway to do this from Sql before you get the data back.
My problem is this, I have a Stored Procedure that returns 2 or 4 tables based on the input parameters so I had an If statement in there
' Verify that the expected results of two tables were return from the Stored Procedure
If (dsPosting.Tables.Count = 4 AndAlso intBankType <> 10) _
OrElse (dsPosting.Tables.Count = 2 AndAlso intBankType = 10) Then
Now the Stored Procedure has changed to 2 or 5 and the order is different. Is there a better way to identify I want "these two table" rather than hard coding the value in code and having to issue a new release.
Ideally I would like something like ds.Table("TheOneIWant")
or something along those lines?
Upvotes: 2
Views: 117
Reputation: 1062780
The successive separate result in TDS do not have names; they are just sequential grids of results. So no, there is no way to do this. Your code needs to know (or be able to deduce) what results it is expecting. One option might be to look at the schema of each as it comes back.
Another way of looking at this is to look at the line:
Now the Stored Procedure has changed to 2 or 5 and the order is different.
That is a breaking change; avoiding breaking changes is a really good idea.
Upvotes: 1