Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > ADO.NET
|
ADO.NET For discussion about ADO.NET.  Topics such as question regarding the System.Data namespace are appropriate.  Questions specific to a particular application should be posted in a forum specific to the application .
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ADO.NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 21st, 2005, 06:21 AM
Registered User
 
Join Date: Sep 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default DataAdapter.Update acts strangely

Hi everyone.

I'm having a bit of a problem with the DataAdapter.Update method... I have a DataSet in which i modify some records but when i call the update method i get the DBConcurrencyException which says that there was nothing to modify (0 records affected by the update).
This is strange because i have verified that prior to calling the update method some records WERE modified and the correspondant rows had the RowState propery set to 'Modified'.

What could be the problem?
Thanks in advance.

Here are some details about how my program is actually working:

- i have a mainform (called MainForm) in which i added the connection to the database (it's a Access database with a single Table called Conturi), a dataadapter called DA_Conturi and a typed dataset (the class is called OPDataSet and the variable DS_Main)

- the table is DS_Main.Conturi and is also typed (OPDataSet.ConturiDataTable)

- i then have another form (a navigator) called ConturiNav to which i pass the table. the user accesses this form by a menu item in the MainForm called MI_Conturi

Here are the constructors for the two classes and the MI_Conturi_Click method which handles the click event on the menu item:

[MainForm.cs]
...
private System.Data.OleDb.OleDbDataAdapter DA_Conturi;
private OPDataSet DS_Main;
public MainForm()
{
    InitializeComponent();
    Conturi.Fill(DS_Main.Conturi);
}
...
private void MI_Conturi_Click(object sender, System.EventArgs e)
{
    ConturiNav cn=new ConturiNav(DS_Main.Conturi);
    cn.ShowDialog();
    cn.Dispose();
    DA_Conturi.Update(DS_Main.Conturi);
}

[ConturiNav.cs]
public OPDataSet.ConturiDataTable conturi;
public DataView dataview;
...
public ConturiNav(OPDataSet.ConturiDataTable conturi)
{
    InitializeComponent();
    this.conturi=conturi;
    dataview=new DataView(this.conturi);
    SometextBox.DataBindings.Add(new
          Binding("Text",dataview,"Somefield"));
        ...
}

the error appears when the users edits the text in 'Sometextbox' and then closes the ConturiNav form.







Similar Threads
Thread Thread Starter Forum Replies Last Post
update dataadapter karenai Visual Basic 2005 Basics 0 February 9th, 2008 10:46 PM
DataAdapter.Update puzzle wirerider ASP.NET 2.0 Basics 1 August 1st, 2006 06:57 PM
Datagrid.update() and DataAdapter.Update aarunlal ASP.NET 2.0 Professional 2 February 23rd, 2006 11:41 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.