How can I compare 2 datasets form 2 completely identical tables in 2
different Databases and get only those records that have changed in one of
the DB's or are new?

Thanks

Re: Modified or new records by William

William
Wed Apr 28 10:41:17 CDT 2004

Use the primary key and loop through value by value and compare the values
of the row, column by column to get the changed ones. You can use a similar
approach to find new ones, sort on the PK and then

IsNul = (dt1.rows[i][PkColumn] != dt2.Rows[i][PkColumn] )

You'll obviously need to cast each to the respective type but the logic is
essentially the same. Or you could build a string of all of the values from
Table one and fire a sql statement with Not In(alloftheValues) and vice
versa..

This is probably much better suited to being handled server side with SQL
Though if at all possible.
"T Cordon" <tcordonb@hotmail.com> wrote in message
news:OQlAT7SLEHA.2704@TK2MSFTNGP10.phx.gbl...
> How can I compare 2 datasets form 2 completely identical tables in 2
> different Databases and get only those records that have changed in one of
> the DB's or are new?
>
> Thanks
>
>



Re: Modified or new records by T

T
Wed Apr 28 11:04:46 CDT 2004

Is there any other way to compare datasets?

"William Ryan eMVP" <dotnetguru@comcast.nospam.net> wrote in message
news:eimWhaTLEHA.3944@tk2msftngp13.phx.gbl...
> Use the primary key and loop through value by value and compare the values
> of the row, column by column to get the changed ones. You can use a
similar
> approach to find new ones, sort on the PK and then
>
> IsNul = (dt1.rows[i][PkColumn] != dt2.Rows[i][PkColumn] )
>
> You'll obviously need to cast each to the respective type but the logic is
> essentially the same. Or you could build a string of all of the values
from
> Table one and fire a sql statement with Not In(alloftheValues) and vice
> versa..
>
> This is probably much better suited to being handled server side with SQL
> Though if at all possible.
> "T Cordon" <tcordonb@hotmail.com> wrote in message
> news:OQlAT7SLEHA.2704@TK2MSFTNGP10.phx.gbl...
> > How can I compare 2 datasets form 2 completely identical tables in 2
> > different Databases and get only those records that have changed in one
of
> > the DB's or are new?
> >
> > Thanks
> >
> >
>
>



Re: Modified or new records by William

William
Wed Apr 28 11:39:56 CDT 2004

Other than rolling your own Compare method, I really don't think so.
"T Cordon" <tcordonb@hotmail.com> wrote in message
news:#IWyFqTLEHA.3892@TK2MSFTNGP11.phx.gbl...
> Is there any other way to compare datasets?
>
> "William Ryan eMVP" <dotnetguru@comcast.nospam.net> wrote in message
> news:eimWhaTLEHA.3944@tk2msftngp13.phx.gbl...
> > Use the primary key and loop through value by value and compare the
values
> > of the row, column by column to get the changed ones. You can use a
> similar
> > approach to find new ones, sort on the PK and then
> >
> > IsNul = (dt1.rows[i][PkColumn] != dt2.Rows[i][PkColumn] )
> >
> > You'll obviously need to cast each to the respective type but the logic
is
> > essentially the same. Or you could build a string of all of the values
> from
> > Table one and fire a sql statement with Not In(alloftheValues) and vice
> > versa..
> >
> > This is probably much better suited to being handled server side with
SQL
> > Though if at all possible.
> > "T Cordon" <tcordonb@hotmail.com> wrote in message
> > news:OQlAT7SLEHA.2704@TK2MSFTNGP10.phx.gbl...
> > > How can I compare 2 datasets form 2 completely identical tables in 2
> > > different Databases and get only those records that have changed in
one
> of
> > > the DB's or are new?
> > >
> > > Thanks
> > >
> > >
> >
> >
>
>