達成目標: 3 つの異なる場所からの 3 つの異なる SQL クエリからの 3 つの異なる dataTables を、関数から返さなければならない 1 つの DataSet にしたいと考えています。
私は持っている :
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)
助けてください..
- 上記のタスクの可能な限り最良の実装を使用したいと思います。