473,387 Members | 1,606 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Comparing Datasets

Hey,

I am stuck on this little problem, I have a database which I use to fill a
dataset when my application loads, however at certain intervals Im filling
another dataset using the same database. What i need to do is find any new
records added. Ive tried all kinds of thinks like DataSet.Merge e.t.c but
just can seem to get the right code combination to find the new records, any
feedback will be really appreciated.

Regards

James

Nov 17 '05 #1
3 1562
Hi James,

Do you have an autoinc primary key?
You'll need an incrementing field to find the new records - or if you want,
all records that doen't appear in first dataset are new (you'll have to use
primary key or any other unique field to do this)

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
www.rthand.com
SLODUG - Slovene Developer Users Group www.codezone-si.info

"JamesWilce" <Ja********@discussions.microsoft.com> wrote in message
news:54**********************************@microsof t.com...
Hey,

I am stuck on this little problem, I have a database which I use to fill a
dataset when my application loads, however at certain intervals Im filling
another dataset using the same database. What i need to do is find any new
records added. Ive tried all kinds of thinks like DataSet.Merge e.t.c but
just can seem to get the right code combination to find the new records,
any
feedback will be really appreciated.

Regards

James

Nov 17 '05 #2
Miha,

Yer they have a primary key although its not auto Inc'd but is unique, what
im stuck is how id actually just say build a dataset filled with all the new
records, Im just confussed as to how to compare them and get the new records
out. Any tips welcome

Regards

Jame
Nov 17 '05 #3
If you have an incrementing key (perhaps timestamp?), you would just do a
"select ... where key>lastkey".
Since you don't have such a thing you have several options.
You might use a select ... NOT IN (all keys that you have already loaded) or
you might load all records and for each record look into the original
dataset (using key) if it already exists.
Something like that...

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
www.rthand.com
SLODUG - Slovene Developer Users Group www.codezone-si.info

"JamesWilce" <Ja********@discussions.microsoft.com> wrote in message
news:64**********************************@microsof t.com...
Miha,

Yer they have a primary key although its not auto Inc'd but is unique,
what
im stuck is how id actually just say build a dataset filled with all the
new
records, Im just confussed as to how to compare them and get the new
records
out. Any tips welcome

Regards

Jame

Nov 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: jacew | last post by:
I want to compare two datasets and retireive the differences. Is the an easy way to do this without trawling through the all records and fields? The basic problem is this. I get a dataset and copy...
1
by: Eric | last post by:
Hello, I am trying to write a webservice to compare 2 datasets, one recieved from a client, and the other taken from a database on the webserver. Sofar, I have had little success in...
0
by: Elliot M. Rodriguez | last post by:
I can accomplish this relatively easily but inefficiently, and it seems like a hack, but I cant think of a better workaround. Hopefully someone else here can. My task is to perform an update on...
19
by: Will Lastname | last post by:
In one of the applications that I'm working on I have 2 sets of functions that build different datasets. Imagine 4 columns in a datagrid. Inside those 4 columns I have nested datalists. Two of...
4
by: Frank | last post by:
Hello, Developing an app where the user fills out a sometimes quite lengthy form of chkboxes, txtboxes, radbtns, etc. User responses are saved to a mySql db, which the user can later edit. When...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.