none
Merging 2 datatables in vb.net RRS feed

  • Question

  • Hi All,

    I am trying to merge 2 datatables with same datatype and same columns.

    I looked at the below link 

    http://msdn.microsoft.com/en-us/library/fk68ew7b.aspx#Y0

    The tricky part is I am getting one datatable from oracle and another from sql server

    Dim dt1 As New List(Of DataTable)

    Using DC1 as New TestDataclassesDataContext()

      Dim query = (From p In dc1.TestColleges Select p)
                    Dim queryResults = (From queryItem In query Select queryItem).ToList()

                    If queryResults.Any Then
                      //  dt1.Add(queryResults)  I am trying to add the results to Dt1 where I am getting the below error

    value of type system.collections.generic.list cannot be converted to 'system.data.datatable'

                    End If

    End using

    2nd Datatable??

    Dim GetTestColleges as New DataSet

    GetClist=GetColleges() // Calls Oracle and gets data

    if getClist isnot nothing then

    dt2.datasource = Getclist

    Endif

    Dt1.Merge(dt2) --- How can I do this????

    Monday, August 6, 2012 7:50 PM