VB.NET: SqlDataReader + DataTable : Copying returned multiple recordset into a single recordsets
Posted on 2011-02-15
In order to improve performance on my SQL Azure database, I want to combine several queries together.
SELECT * FROM Table1;
SELECT * FROM Table2;
SELECT * FROM Table3;
I have three DataTable objects that I would like to copy the returned data.
Dim dtTable1 As New DataTable
Dim dtTable2 As New DataTable
Dim dtTable3 As New DataTable
When I load the DataTable object with the recordset, it appears to include all returned recordsets, rather than just one.
After several recordsets are copied into the DataTables, it errors.
A first chance exception of type 'System.InvalidOperationException' occurred in System.Data.dll
If I run the queries separately, I don't receive the error. I am trying to accomplish:
o Single, quick query to the Azure server using 1 query
o Update the DataTable objects with the returned recordsets, separately
Is there a way to "copy" out a single recordset to a new object without the other recordsets included?