Very old question, but in case someone else stumbles upon this... Found the answer in this SO answer: If you use DataTable.Load()
then you should not use rdr.NextResult()
, as that is taken care implicitly. Simply call .Load()
for your next table. So, for example, if you have an expectedTableCount
:
ds = new DataSet();
ds.Tables.Add("Table1");
ds.Tables[0].Load(reader);
for (int ii = 1; ii < expectedTableCount; ii++)
{
ds.Tables.Add("Table" + (ii + 1));
ds.Tables[ii].Load(reader);
}