I’m not even sure what I’m asking is even possible, but here goes:
Is there a way to loop through a sqlDataAdapter to find multiple tables?
Currently I have a module that you pass in an object and it automatically fills the parameters of a stored procedure with the values of the object. It works great, except when the stored procedure returns more than one table, it only returns the first one.
Here is what I tried to get to that second table:
Dim ds As New DataSet
Dim table As New DataTable
Dim reader As SqlDataReader = command.ExecuteReader
While reader.IsClosed = False
reader.Read()
Try
table.Load(reader)
If Not ds.Tables.Contains(table.TableName) Then
ds.Tables.Add(table)
End If
Catch ex As Exception
End Try
End While
Any help / ideas would be helpfull!
You don’t want a SqlDataReader. You want a SqlCommand, A SqlDataAdapter, and rigorous use of the
usingstatement: