Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Subsequent query against result set...
Message
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
00685795
Message ID:
00685949
Vues:
39
The DataAdapters allow you to have more than one select statement in the SelectCommand. You can also write a stored procedure that returns multiple tables. If you do this the tables are refereed to as Table, Table1, Table2, etc.

>>>The initial query is fairly complex (there are a dozen different conditions), so the query string still needs to be built in the middle tier and then passed to the stored proc.<
>
>It sounds like you are still running a SP. Are you passing some kind of string to it as a parameter?
>
>Anyway, as long as you are running a SP, you can return multiple result sets easy enough. Obviously, the benefit to this is not having two roundtrips back to the server, if the SP can return both result sets at the same time (the SP simply has two SELECTS ... if you can run the SP in the Query Analyzer, you'll see what I mean about returning two result sets).
>
>But, if the logic is really, really complicated, sometimes it's a major PITA to write it in T-SQL ... it just isn't flexible enough. So, doing some of the work in your code instead is a perfectly acceptable way of doing things, since typically your middle-tier stuff runs server-side anyway.
>
>If you're just running a Query and not a SP, I think you can still bring back multiple result sets by specifying two SELECT queries in your string (haven't done it, so can't say for sure ... but I *think* that'll work).
>
>
>~~Bonnie
>
>
>
>>I *could*, and that was an option I neglected to mention.
>>
>>The initial query is fairly complex (there are a dozen different conditions), so the query string still needs to be built in the middle tier and then passed to the stored proc.
>>
>>There's another issue (and it's probably just my lack of understanding of how one would do this in SQL)....I need to get back a detailed results set (e.g. 1000 records) and a summary results set of those 1,000 (which might be, say, 20 records). I've never been able to figure out how to bring back multiple result sets in one single query/stored proc.
>>
>>Only thing I've ever been able to come up with even close is a union, where I'd bring back one result set with an additonal flag that indicates whether each record is from the detailed results set or the summary set. (The summary set will usually have the same structure as the detailed set). Then the middle tier would just strip out the summary set. It seems a bit kludgy, and I'm searching for something cleaner.
>>
>>Thanks,
>>Kevin
-----------------------------------------

Cathi Gero, CPA
Prenia Software & Consulting Services
Microsoft C# / .NET MVP
Mere Mortals for .NET MVP
cgero@prenia.com
www.prenia.com
Weblog: blogs.prenia.com/cathi
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform