TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Thomas Boyd
NA
9
0
Duplicate records entered on update
Feb 26 2008 12:26 PM
OK, I've been trying to figure this out for almost 2 weeks and I can't seem to perfrom a serach that identifies anyone else having the same problem... I have a small access database I created to hold daily observations of an instrument's performance and state (in the laboratory)... I was playing with data I've logged in the book for years and I thought I might be making some connections, so I thought having an automated record which could be graphed would be kinda cool. Like to keep my programming skills fresh too. When I leaned ADO.NET it was with VS2002, so I was playing with the VS2005 tools and I just dragged a BindingSource onto my MainForm, then used it to make a deataset and annotated the datatable as the datamember. See
here
and
here
. All good. I can call the Adapter.Update() method when adding a new row without any problem. I have a form which lets me edit and/or delete records (all works fine on the in-memory dataset) and a form which graphs the data. When I close out my app, I want the access database file to be updated accordingly. Here's where havoc insues. I was using the following code:
[CODE]
private void MainForm_FormClosed(object sender, FormClosedEventArgs e)
{
if (this.iRMSLogDataSet.HasChanges())
{
DataSet dsChanges = iRMSLogDataSet.GetChanges();
this.iRMSLogTableAdapter.Connection.Open();
this.iRMSLogTableAdapter.Update((iRMSLogDataSet)dsChanges);
this.iRMSLogDataSet.AcceptChanges();
this.iRMSLogTableAdapter.Connection.Close();
}
}
[/CODE]
It creates duplicate records in the main database file which are in the in-memory DataSet upon closing the app! So if I delete records 6-8, records 1-5 and 9-XX will all be duplicated in my access database file. I can't for the life of me figure out why??? I know I must be missing something simple, but in weeks of searching I can't find someone who's had this same problem and has a solution.... Any help would be most appreciated!
Tom
Reply
Answers (
1
)
Path problems with authentication forms
C# regex file parser