can ADO.NEt actuualy solve this??

  • Thread starter Thread starter Calvin Lai
  • Start date Start date
C

Calvin Lai

Hi all,

I have been searching around in MSDN for awhile and found no answer for this
question.

Say I have two data sources (Table) where they have the same schema but
perhaps w/ different data contained.
Can I actually Merge (I tried the one in Dataset and no idea how it can be
used in this context) the two data and dump it into one of the table (or
data source). The data might need to be updated or inserted depending on if
that record is exist in the table already.

If anyone has any idea, please do help me. Thanks a lot.

Calvin
 
Hi Calvin,

Can't you simply open both as datatables and addnew to one from the other,
checking first (perhaps using a dataview) for one in the other and either
adding or updating as required?

HTH,

Bernie Yaeger
 
Yes, you can
let's assume you have t1, t2 tables, same schema, different data

first , select all the data in t2 that is not in t1, so what you get is a
data set called ds3,
now get a dataset from table t1,
insert data in ds3, into the dataset obtained from t1

then you select all the data in table t1 that is not in t2, call this
dataset ds4
now get dataset from table t2
insert the data from ds4 into t2

The best way to achieve this to by using stored procedures

Francisco
 
You could also do a Union at the stored procedure level
HT
Regard
Harsh Thaku

----- Calvin Lai wrote: ----

Hi all

I have been searching around in MSDN for awhile and found no answer for thi
question

Say I have two data sources (Table) where they have the same schema bu
perhaps w/ different data contained
Can I actually Merge (I tried the one in Dataset and no idea how it can b
used in this context) the two data and dump it into one of the table (o
data source). The data might need to be updated or inserted depending on i
that record is exist in the table already

If anyone has any idea, please do help me. Thanks a lot

Calvin
 
I can't do this because they are from different server/database. e.g One is
SQL and the other is Oracle.
But thanks for this insight.
 
This in fact is one of my not-so-perfered solution. The reason was because I
thought the Merge function provided in DataSet can somehow leverage me from
doing this *dirty* work. Yes, I know this isn't that dirty in fact. But I
just want to be lazy and let microsoft do my work...I guess I can' t then =)

Thanks for your help!

Calvin
 
In fact, yes I could. but I was just wonder if there is any smart methods
provided by Microsoft (I thought it was the merge function) that can
leverage me from doing the comparison work. I guess I couldn't then...thanks
a lot for your help.

Calvin
 
Back
Top