M
Matthew Dill
I have two resultsets that I'm returning via a command object. When I use
the data adapter to 'fill' the dataset I specify the srcTable name. Since
there are multiple resultsets the name is incremented for the second table
(I end up with CarrierData and CarrierData1. I'm getting all the data I
want and can deal with it accordingly. However, I would like to control the
names of the second srcTable in the Dataset. How do I do this?
This is the current code (minus error trapping). Any help would be
appreciated.
Public Function Fetch(ByVal vlngCarrierID As Long) As DataSet
'Create Command object
Dim lobjCommand As New SqlClient.SqlCommand("SELECT * FROM vwCarrier
WHERE CarrierID = " & vlngCarrierID & _
"SELECT * FROM vwNote
WHERE OrigEntityID = 1 AND OrigRefID = " &
vlngCarrierID, mobjSQLConn)
'Create Data Adapter
Dim lobjDataAdapter As New SqlClient.SqlDataAdapter(lobjCommand)
'Create an empty Dataset
Dim lobjDataSet As New DataSet
'Use the DataAdapter to create & fill a new DataTable called
'ListData'
lobjDataAdapter.Fill(lobjDataSet, "CarrierData")
*** What I would like is two Tables one called "CarrierData" and the
other call "CarrierNotes" ***
Return lobjDataSet
End Function
the data adapter to 'fill' the dataset I specify the srcTable name. Since
there are multiple resultsets the name is incremented for the second table
(I end up with CarrierData and CarrierData1. I'm getting all the data I
want and can deal with it accordingly. However, I would like to control the
names of the second srcTable in the Dataset. How do I do this?
This is the current code (minus error trapping). Any help would be
appreciated.
Public Function Fetch(ByVal vlngCarrierID As Long) As DataSet
'Create Command object
Dim lobjCommand As New SqlClient.SqlCommand("SELECT * FROM vwCarrier
WHERE CarrierID = " & vlngCarrierID & _
"SELECT * FROM vwNote
WHERE OrigEntityID = 1 AND OrigRefID = " &
vlngCarrierID, mobjSQLConn)
'Create Data Adapter
Dim lobjDataAdapter As New SqlClient.SqlDataAdapter(lobjCommand)
'Create an empty Dataset
Dim lobjDataSet As New DataSet
'Use the DataAdapter to create & fill a new DataTable called
'ListData'
lobjDataAdapter.Fill(lobjDataSet, "CarrierData")
*** What I would like is two Tables one called "CarrierData" and the
other call "CarrierNotes" ***
Return lobjDataSet
End Function