Aim to Achieve : I want to have 3 different dataTables from 3 different SQL queries from 3 different places into 1 single DataSet which I will have to return form my function.
I have :
Private Function getDataSet()
Dim ad1,ad2,ad3 As Object
ad1 = New Data.OleDb.OleDbDataAdapter(query1, conStr1)
ad2 = New Data.SqlClient.SqlDataAdapter(query2, conStr2)
ad3 = New Data.SqlClient.SqlDataAdapter(query3, conStr3)
Dim dataSet As New Data.DataSet
// I want to fill dataSet with the 3 adapters !
// ad1.Fill(dataSet) : ad2.Fill(dataSet) : ad3.Fill(dataSet)
// Will this work ?
ad1.Dispose() : ad2.Dispose() : ad3.Dispose() // What does Dispose() method do ?
Return dataSet
End Function
Dim ds = getDataSet()
data1 = ds.Tables(0)
data2 = ds.Tables(1)
data3 = ds.Tables(2)
Please Help..
- I want to use the best possible implementation of above task.