It depends on your database... some implementations don't support batch
queries. But for Sql Server or Oracle for instance, you can definitely
batch up the commands and fire them. If you fill a dataSet for instance,
each select query will populate a different table within the dataset and you
use TableMappings to specify how that happens. Similiarly, if you use a
DataReader, you can use while(reader.Read()){
} to walk through your reader, but if you have multiple select statements,
you can wrap the while (reader.Read()) inside a do { } while
reader.NextResult() to walk through the next query.
As far as your specific scenario - go to
www.betav.com -> Articles -> MSDN .
The illustrious Mr Vaughn has two articles on the matter - Managing an
@@Identity Crisis and Retrieving the Gozoutas that I can assure you, you'll
find enlightening and speak directly to the issue you ask about. The short
answer though is that you can use another Sql Statement (that's actually
what the data Adapter Configuration Wizard does if you select the Refresh
DataSet option) or you can use an OutPut Parameter for instance. His
articles describe both in detail.
Cheers,
Bill