Results 1 to 3 of 3

Thread: datatable question?

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2002
    Location
    top of the mountain
    Posts
    234

    Question datatable question?

    I have table1 and table2, tables have same structure (all fields are same). My question is which is the easiest way to add data from table2 into table1?

    regard j

  2. #2
    Frenzied Member Mike Hildner's Avatar
    Join Date
    Jul 2002
    Location
    Des Moines, NM
    Posts
    1,690
    Not sure what DB you're using, if it's MSSQL, look up SELECT INTO in BOL (books online).

  3. #3
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Something like this (I did test the code though)

    VB Code:
    1. Private Sub CopyDT()
    2.         'DataTable One that we'll copy from
    3.         Dim DT1 As New DataTable("Tb Name")
    4.  
    5.         'DataTable Two that we'll copy to
    6.         Dim DT2 As New DataTable("Tb Name")
    7.  
    8.         Dim adp As New OleDb.OleDbDataAdapter
    9.         'Get data from DataTable One
    10.         adp.Fill(DT1)
    11.  
    12.         'Update from DataTable One
    13.         adp.Update(DT2)
    14.     End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width