473,669 Members | 2,466 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Duplicate rows in the Dataset!

20 New Member
Hello!

I use DataAdapter.Fil l method to fill the dataset with data from a SQL database table. But when the same method is called for a second time subsequently, it appends the data instead of overwriting the duplicate rows in the table.

For example, i use DataAdapter.Fil l(mydataset,"my table"). the "mytable" has 50 rows and copies the same to "maytable" in mydataset. But after a subsequent call to DataAdapter.Fil l(mydataset,"my table"), the mytable in mydataset has 100 rows (i.e all the 50 rows duplicated).

Can anyone please tell me how to avoid that!!
I hope I have posted this in the right forum,else let me know...

Thank you!
Oct 26 '06 #1
2 3614
jorgepino
6 New Member
the DataAdapter does not set a PrimaryKey value for the resulting DataTable. You must explicitly define the primary key to ensure that duplicate rows are resolved correctly
Oct 26 '06 #2
helloitsme
20 New Member
Thank you for replying...

I tried doing so using the following before doing the .Fill -


Expand|Select|Wrap|Line Numbers
  1. DA.MissingSchemaAction = MissingSchemaAction.AddWithKey;
if this is what you were talking about, then this did not help either...
Please let me know if did something wrong or understood wrong...

thanx...
Oct 26 '06 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

6
3488
by: John J. Hughes II | last post by:
Normally when I use the Adaptor update function and it work fine but sometimes I get a "duplicate entry" error after the merge. I believe the problem is because the primary key is modified and the merge function is unable compensate for this event. I see three possible solutions to this problem. One being not to let them update the key which is not an option. Two being to determine if the key has changed and refilling the entire dataset...
5
2380
by: Steve B. | last post by:
A particular column in my Access DB table, and the associated datagrid, cannot have duplicate string entries. I've selected "Yes (no duplicates)" for the Indexed Field Property of this column in the Access table. When I call update(), the DB gets updated but throws an exception saying, in affect, that I'm trying to change the key. This column is not the key. How do I handle this? How do I stop the ex.message being thrown? I guess I...
1
1781
by: Asha | last post by:
greetings, does anyone have any idea how to delete duplicate rows in a dataset gracefully (the fast and easy way)
12
1993
by: Graham Blandford | last post by:
Hi all, Would someone be able to tell me the most 'graceful' way of removing unwanted rows from a dataset based on a condition prior to update? OR, resetting the rows all to unchanged after they are initally added to the recordset. I create a dataset, which begins empty after the initial .Fill. Then I create several rows with some default information, leaving one
4
921
by: Martin Williams | last post by:
Still working out a few bugs in a survey program I'm writing. The way I have it configured is as each survey is completed, the dataset is updated. When the program is closed, the database itself is updated. However, when I check the database table, there are some answers that are duplicated two and three times. Here are some snippets... //This sub is called on the last page of the survey when the "Finish" button is clicked.
12
3705
by: | last post by:
Hello, How would I remove duplicate rows from a dataset after it has already been populated? What would be the best way to check each row and delete duplicates while leaving at least one unique of the duplicate rows? Any Ideas?
0
2116
by: kiki | last post by:
I have two datasets with the same schema,each of which has some datarows.After i merge them into one datset i found that there were some duplicate rows in these rows.then how can i remove the duplicate record and get the unique rows? Thanks for your replying and any answer is appreciated.
10
6773
by: Backwards | last post by:
Hello all, I'll start by explaining what my app does so not to confuss you when i ask my question. ☺ I have a VB.Net 2.0 app that starts a process (process.start ...) and passes a prameter through from a combo box. The combo box items are made up of IP address and computer host name. Anything a user places in this combo box it writes this to a txt file called history.txt
0
844
by: Arvi | last post by:
Hi, Is there any way to check for the duplicated (fluteid) records in the dataset other than the following method? i need to avoid goin thru all the records everytime (squaremethod) instead i want to check with the triangle method. can someone help me here?
0
8895
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8809
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...
0
7407
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
6210
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
5682
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4206
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4386
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2032
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1788
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.