473,788 Members | 2,726 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DataAdapter.Acc eptChangesDurin gUpdate not working


I have set DataAdapter.Acc eptChangesDurin gUpdate = true;

However, I find that I still need to call AcceptChanges on the associated
DataTable,

DataTable.Accep tChanges();

Has anyone encountered that? Am I not setting this field properly?

The following are some of the snippets of the codes which may help explain
what I was doing,
//Setting DataAdapter.Acc eptChangesDurin gUpdate
{
....

jobListDataAdap ter = new
System.Data.Ole Db.OleDbDataAda pter(commandStr ing, oOleDbConn);

oOleDbCommandBu ilder = new
System.Data.Ole Db.OleDbCommand Builder(jobList DataAdapter);

jobListDataTabl e = new System.Data.Dat aTable("Job List
Access DataTable");
jobListDataAdap ter.AcceptChang esDuringFill = true;
jobListDataAdap ter.AcceptChang esDuringUpdate = true;

jobListDataAdap ter.Fill(jobLis tDataTable);
....
}

Thanks,

--
George
Jun 16 '06 #1
5 5045
You are only getting data into the table in this example. You are not
updating the database, so that property would not be relevant.

"George" <wa**@nospam.no spam> wrote in message
news:E0******** *************** ***********@mic rosoft.com...

I have set DataAdapter.Acc eptChangesDurin gUpdate = true;

However, I find that I still need to call AcceptChanges on the associated
DataTable,

DataTable.Accep tChanges();

Has anyone encountered that? Am I not setting this field properly?

The following are some of the snippets of the codes which may help explain
what I was doing,
//Setting DataAdapter.Acc eptChangesDurin gUpdate
{
...

jobListDataAdap ter = new
System.Data.Ole Db.OleDbDataAda pter(commandStr ing, oOleDbConn);

oOleDbCommandBu ilder = new
System.Data.Ole Db.OleDbCommand Builder(jobList DataAdapter);

jobListDataTabl e = new System.Data.Dat aTable("Job List
Access DataTable");
jobListDataAdap ter.AcceptChang esDuringFill = true;
jobListDataAdap ter.AcceptChang esDuringUpdate = true;

jobListDataAdap ter.Fill(jobLis tDataTable);
...
}

Thanks,

--
George

Jun 16 '06 #2
The snippet only demonstrate how I setup AcceptChangesDu ringUpdate.

Eventually, at some other location I would have call

{
....
oChangeDataTabl e = this.jobListDat aTable.GetChang es();
if (oChangeDataTab le != null)
{
this.JobListDat aAdapter.Update (oChangeDataTab le);

foreach (System.Data.Da taRow oDataRow in
oChangeDataTabl e.Rows)
{
if (oDataRow[JobDataGridView ColumnId] ==
System.DBNull.V alue)
{
this.jobListDat aTable.Clear();

this.jobListDat aAdapter.Fill(t his.jobListData Table);
break;
}
}

jobListDataTabl e.AcceptChanges ();

....
}

After Update(), the RowState of changed rows seem to be updated to
"unchanged" from "Added", "Deleted".. . and what not.

However, without specifically calling DataTable.Accep tChanges(), the next
call to DataTable.GetCh anges() still returns a table of changed rows.

Any ideas?

--
George
"Marina Levit [MVP]" wrote:
You are only getting data into the table in this example. You are not
updating the database, so that property would not be relevant.

"George" <wa**@nospam.no spam> wrote in message
news:E0******** *************** ***********@mic rosoft.com...

I have set DataAdapter.Acc eptChangesDurin gUpdate = true;

However, I find that I still need to call AcceptChanges on the associated
DataTable,

DataTable.Accep tChanges();

Has anyone encountered that? Am I not setting this field properly?

The following are some of the snippets of the codes which may help explain
what I was doing,
//Setting DataAdapter.Acc eptChangesDurin gUpdate
{
...

jobListDataAdap ter = new
System.Data.Ole Db.OleDbDataAda pter(commandStr ing, oOleDbConn);

oOleDbCommandBu ilder = new
System.Data.Ole Db.OleDbCommand Builder(jobList DataAdapter);

jobListDataTabl e = new System.Data.Dat aTable("Job List
Access DataTable");
jobListDataAdap ter.AcceptChang esDuringFill = true;
jobListDataAdap ter.AcceptChang esDuringUpdate = true;

jobListDataAdap ter.Fill(jobLis tDataTable);
...
}

Thanks,

--
George


Jun 16 '06 #3
Which table are you checking for the row state - jobListDataAdap ter or
oChangeDataTabl e?

"George" <wa**@nospam.no spam> wrote in message
news:14******** *************** ***********@mic rosoft.com...
The snippet only demonstrate how I setup AcceptChangesDu ringUpdate.

Eventually, at some other location I would have call

{
...
oChangeDataTabl e = this.jobListDat aTable.GetChang es();
if (oChangeDataTab le != null)
{
this.JobListDat aAdapter.Update (oChangeDataTab le);

foreach (System.Data.Da taRow oDataRow in
oChangeDataTabl e.Rows)
{
if (oDataRow[JobDataGridView ColumnId] ==
System.DBNull.V alue)
{
this.jobListDat aTable.Clear();

this.jobListDat aAdapter.Fill(t his.jobListData Table);
break;
}
}

jobListDataTabl e.AcceptChanges ();

...
}

After Update(), the RowState of changed rows seem to be updated to
"unchanged" from "Added", "Deleted".. . and what not.

However, without specifically calling DataTable.Accep tChanges(), the next
call to DataTable.GetCh anges() still returns a table of changed rows.

Any ideas?

--
George
"Marina Levit [MVP]" wrote:
You are only getting data into the table in this example. You are not
updating the database, so that property would not be relevant.

"George" <wa**@nospam.no spam> wrote in message
news:E0******** *************** ***********@mic rosoft.com...
>
> I have set DataAdapter.Acc eptChangesDurin gUpdate = true;
>
> However, I find that I still need to call AcceptChanges on the
> associated
> DataTable,
>
> DataTable.Accep tChanges();
>
> Has anyone encountered that? Am I not setting this field properly?
>
> The following are some of the snippets of the codes which may help
> explain
> what I was doing,
>
>
> //Setting DataAdapter.Acc eptChangesDurin gUpdate
> {
> ...
>
> jobListDataAdap ter = new
> System.Data.Ole Db.OleDbDataAda pter(commandStr ing, oOleDbConn);
>
> oOleDbCommandBu ilder = new
> System.Data.Ole Db.OleDbCommand Builder(jobList DataAdapter);
>
> jobListDataTabl e = new System.Data.Dat aTable("Job List
> Access DataTable");
> jobListDataAdap ter.AcceptChang esDuringFill = true;
> jobListDataAdap ter.AcceptChang esDuringUpdate = true;
>
> jobListDataAdap ter.Fill(jobLis tDataTable);
> ...
> }
>
>
>
> Thanks,
>
> --
> George


Jun 16 '06 #4
Hi Marina,

I figured out what I did wrong. I guess the reason is related to your
question as well.

I have called DataAdapter.Upd ate(oChangeData Table). I thought this will be
more efficient since it is a smaller or equal size table. However, the
AcceptChangesDu ringUpdate flag is causing oChangeDataTabl e.AccpetChanges () to
be called, while jobListDataTabl e's changes have not been accepted.

Now I changed my call to DataAdapter.Upd ate(jobListData Table) and it works
as I desired. I came across this while I was review my codes and realized
that DataAdapter does contain any reference to a particular DataTable. the
DataTable is passed into method's parameter.

Thanks for your help

--
George
"Marina Levit [MVP]" wrote:
Which table are you checking for the row state - jobListDataAdap ter or
oChangeDataTabl e?

"George" <wa**@nospam.no spam> wrote in message
news:14******** *************** ***********@mic rosoft.com...
The snippet only demonstrate how I setup AcceptChangesDu ringUpdate.

Eventually, at some other location I would have call

{
...
oChangeDataTabl e = this.jobListDat aTable.GetChang es();
if (oChangeDataTab le != null)
{
this.JobListDat aAdapter.Update (oChangeDataTab le);

foreach (System.Data.Da taRow oDataRow in
oChangeDataTabl e.Rows)
{
if (oDataRow[JobDataGridView ColumnId] ==
System.DBNull.V alue)
{
this.jobListDat aTable.Clear();

this.jobListDat aAdapter.Fill(t his.jobListData Table);
break;
}
}

jobListDataTabl e.AcceptChanges ();

...
}

After Update(), the RowState of changed rows seem to be updated to
"unchanged" from "Added", "Deleted".. . and what not.

However, without specifically calling DataTable.Accep tChanges(), the next
call to DataTable.GetCh anges() still returns a table of changed rows.

Any ideas?

--
George
"Marina Levit [MVP]" wrote:
You are only getting data into the table in this example. You are not
updating the database, so that property would not be relevant.

"George" <wa**@nospam.no spam> wrote in message
news:E0******** *************** ***********@mic rosoft.com...
>
> I have set DataAdapter.Acc eptChangesDurin gUpdate = true;
>
> However, I find that I still need to call AcceptChanges on the
> associated
> DataTable,
>
> DataTable.Accep tChanges();
>
> Has anyone encountered that? Am I not setting this field properly?
>
> The following are some of the snippets of the codes which may help
> explain
> what I was doing,
>
>
> //Setting DataAdapter.Acc eptChangesDurin gUpdate
> {
> ...
>
> jobListDataAdap ter = new
> System.Data.Ole Db.OleDbDataAda pter(commandStr ing, oOleDbConn);
>
> oOleDbCommandBu ilder = new
> System.Data.Ole Db.OleDbCommand Builder(jobList DataAdapter);
>
> jobListDataTabl e = new System.Data.Dat aTable("Job List
> Access DataTable");
> jobListDataAdap ter.AcceptChang esDuringFill = true;
> jobListDataAdap ter.AcceptChang esDuringUpdate = true;
>
> jobListDataAdap ter.Fill(jobLis tDataTable);
> ...
> }
>
>
>
> Thanks,
>
> --
> George


Jun 16 '06 #5
Hi George,

Yes, this is the case. In addition, you don't need to use GetChanges to get
the difference set to update as this will not improve performance, unless
you're passing the DataSet through a web-service.

Kevin Yu
Microsoft Online Community Support

=============== =============== =============== =============== =============== =
=============== ===========
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=============== =============== =============== =============== =============== =
=============== ===========

(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Jun 19 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2314
by: Dotnetified | last post by:
Reposting after about 2 weeks of no response ... thanks if you can help... ---------------------------------------------------------------------------- -------------- To anyone who thinks they know it all: ;) We recently upgraded our MSDN Version of VS.NET 2002 to VS.NET 2003... Things are all working well, except we've run across a new bug or issue since our adopting of the new package.
2
4272
by: hch | last post by:
dataAdapter.Update(data, "TableName") won’t work! I was about to deploy my first website on the Internet only to discover that the dataAdapter.Update() throws the Server Error in the third underline. It was working fine before. ConnectionString in Web.config: ----------------------------------------- <?xml version="1.0" encoding="utf-8" ?> <configuration>
20
1671
by: TJ Doherty | last post by:
Need help understanding the following please: When I am creating a project and code my connection using Dim connectString As String = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=C:\Temp\NW-test.MDB", everything works correctly when I run the project. However, if I set up the exact same connection using the DataAdapter wizard and try to run the project, I get a "Microsoft Jet database engine cannot open the file..." error.
6
1579
by: Geoff Pennington | last post by:
I have a class method that returns a DataAdapter. I want to access the table(s) contained in the DataAdapter. Of course, accessing the DataSets would be good enough, because I could get the tables from there. I can't find a way to do this. Am I missing something? Much obliged.
6
4741
by: Jack | last post by:
I have the following: * An OLEDBCommand with command text "SELECT CAMPAIGN, DAY_OUT WHERE (CAMPAIGN LIKE '@campaign')" * A DataAdapter that point the select to the above command * A data grid that I use to display the data * form load code to populate the controls: DsCampaign1 = New DataSet cmdProActiTmp_Sel.Parameters.Item("@Campaign").Value = _ Trim(txtcampaign.Text())
3
1879
by: Larry Woods | last post by:
I have a datagrid that is carrying all fields of a record...except one. Now I want to update the underlying database via a dataadapter. The update is working but the field that is "left out" is not there, of course. How do I get that field back into the datatable for the database update? TIA, Larry Woods
4
1788
by: astro | last post by:
I would like to build some generic code that is able to figure out the correct dataAdapter to apply changes to given a form with several dataAdapters. Any suggestions on the following? Thank you. ====================================== Private Sub SaveChanges(ByVal aContainer As Object)
8
2698
by: Zorpiedoman | last post by:
I keep getting a concurrency exception the second time I make a change and attempt to update a dataadapter. It appears this is by design, so there must be something I can do to avoid it. Example: I have a dataadapter that contains one table with one row. I change the value of the 'FisrtName' column in that row from Jack to John. I call ..update on the dataadapter it goes through fine. Now I change that same column in that same row...
4
11168
by: George | last post by:
Got a question about the side effect of DataAdapter.Update() and DataTable.GetChanges(). Say I set up a DataTable and a DataAdapter in a class. Delete (Not remove) a row in the data table and call the following method. public void JobListDataTableFromAccessCommitChange() { System.Data.DataTable oChangeDataTable;
0
9656
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
10175
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
10112
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
9969
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8993
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...
0
6750
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
5399
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
5536
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2894
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.