473,785 Members | 2,414 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1580
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********@dis cussions.micros oft.com> wrote in message
news:54******** *************** ***********@mic rosoft.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********@dis cussions.micros oft.com> wrote in message
news:64******** *************** ***********@mic rosoft.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
385
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 it. I then load the data into a web form. The user then makes any changes to the form. when he saves the form data all the fields are written back to the dataset whether there have been any changes or not. I then want to compare this saved dataset...
1
10462
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 accomplishing that, but that may be due to the fact that I'm a relative newbie on C# :-) Does anybody have a clue, a hint, or maybe even some sample code?
0
1293
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 a dataset retrieved from SQL Server 2000 using a stored procedure. This is the base dataset. Users will send an Excel document up to a webserver and that excel document, which matches the schema of the SQL dataset (few differences but nothing ...
19
2982
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 the datalists' datasources point to database A and the other two point to database B. This effect allows the client to perform a side-by-side comparison of the same product so that records can be updated accordingly. It's easy enough to scroll down...
4
3721
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 the user chooses to edit, I pull the responses from the db, toss them in a dataset, check the checks, fill the txtboxes, etc.,etc. The user then adds, deletes, or changes entries as needed and clicks the Save Changes button. Here is where the fun...
0
9646
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10157
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10096
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8982
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7504
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5514
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4055
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3658
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2887
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.