R
Rich
Hello,
I have a large table in Sql Server that I want to populate
from a VB.Net app. I have 2 data sources that are exactly
the same structure but data from different geographic
locations. I want to populate 2 separate dataTables in my
VB.Net app (simultaneously on different threads) with the
respective source data and then I want to merge the data
from these 2 separate dataTables into a dataTable that I
create from a Sql DataAdapter. I know how to use a Sql
Adapater (sort of)
Dim SqlDA As SqlDataAdapter = New SqlDataAdapter
....
sqlDA.SelectCommand = New SqlCommand("Select * From
tbl1",conn)
....
sqlDA.Fill(dataSet1, "tbl1") - creates a dataTable with
the correct schema.
I tried doing the following with my 2 separate datatables
Dim dt1 As DataTable = ds1.Tables("tbl1")
Dim dt2 As DataTable = ds1.Tables("tbl1")
But dt1 and dt2 turned out to be the same table. If I
place from 1 to 1000 records in dt1 and 1001 to 2000 recs
in dt2 (simultaneously using multithreading), tbl1
contains 4000 recs, not 2000. I would like to create dt1
with the same schema as tbl1 and dt2 also. Then I want to
transfer the data from dt1 and dt2 into tbl1. In my
situation, simultaneously pick up data and place it into
tbl1 where I end up with 2000 records, not 4000. What is
the best way to do this? How do I transfer the data from
dt1 and dt2 into tbl1 (not even worried about updating the
Sql Server table for now - just end up with 2000 records
in tbl1 from dt1 and dt2).
TIA,
Rich
I have a large table in Sql Server that I want to populate
from a VB.Net app. I have 2 data sources that are exactly
the same structure but data from different geographic
locations. I want to populate 2 separate dataTables in my
VB.Net app (simultaneously on different threads) with the
respective source data and then I want to merge the data
from these 2 separate dataTables into a dataTable that I
create from a Sql DataAdapter. I know how to use a Sql
Adapater (sort of)
Dim SqlDA As SqlDataAdapter = New SqlDataAdapter
....
sqlDA.SelectCommand = New SqlCommand("Select * From
tbl1",conn)
....
sqlDA.Fill(dataSet1, "tbl1") - creates a dataTable with
the correct schema.
I tried doing the following with my 2 separate datatables
Dim dt1 As DataTable = ds1.Tables("tbl1")
Dim dt2 As DataTable = ds1.Tables("tbl1")
But dt1 and dt2 turned out to be the same table. If I
place from 1 to 1000 records in dt1 and 1001 to 2000 recs
in dt2 (simultaneously using multithreading), tbl1
contains 4000 recs, not 2000. I would like to create dt1
with the same schema as tbl1 and dt2 also. Then I want to
transfer the data from dt1 and dt2 into tbl1. In my
situation, simultaneously pick up data and place it into
tbl1 where I end up with 2000 records, not 4000. What is
the best way to do this? How do I transfer the data from
dt1 and dt2 into tbl1 (not even worried about updating the
Sql Server table for now - just end up with 2000 records
in tbl1 from dt1 and dt2).
TIA,
Rich