473,508 Members | 2,428 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.Fill 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.Fill(mydataset,"mytable"). the "mytable" has 50 rows and copies the same to "maytable" in mydataset. But after a subsequent call to DataAdapter.Fill(mydataset,"mytable"), 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 3600
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
3475
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...
5
2374
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...
1
1770
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
1976
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...
4
915
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...
12
3689
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...
0
2109
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...
10
6753
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...
0
837
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...
0
7231
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,...
0
7133
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
7405
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...
1
7066
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...
1
5059
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...
0
4724
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...
0
3214
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...
1
773
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
435
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...

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.