PC Review


Reply
Thread Tools Rate Thread

Cannot update database

 
 
Ken Foskey
Guest
Posts: n/a
 
      7th Jul 2008
I am getting more and more frustrated with this.

foreach (DataGridViewRow row in venuesDataGridView.Rows)
{
myDataSet.VenuesRow data = (myDataSet.VenuesRow)((DataRowView)
row.DataBoundItem).Row;
... skip some...

data.BeginEdit();

if( data.IsNull("End1") )
{
data.End1 = ScoreVenue["NorthernEnd"].ToString();
}
if (data.IsNull("End2"))
{
data.End2 = ScoreVenue["SouthernEnd"].ToString();
}
data.EndEdit();
data.AcceptChanges(); / figure this commits but it does not!!!
... more code ...
}

And what I figure 'should' commit without data.?edit commands and
data.acceptchanges.

private void EndEditOnAllBindingSources()
{
var BindingSourcesQuery =
from Component bindingSources in
this.components.Components
where bindingSources is BindingSource
select bindingSources;

foreach (BindingSource bindingSource in BindingSourcesQuery)
{
bindingSource.EndEdit();
}
}

private void UpdateDatabase()
{
Validate();

EndEditOnAllBindingSources();

myAdapterManager.UpdateAll(myDataSet); // hierarchy is set
correctly.

myDataSet.AcceptChanges(); // this should not be needed.
}


I cannot get my data that is written by program into the table back onto
disk which is an access table.

Thanks
Ken

 
Reply With Quote
 
 
 
 
Marc Gravell
Guest
Posts: n/a
 
      7th Jul 2008
AcceptChanges says "this object doesn't need updating", which is the
exact opposite of what you want. Try removing this line.

Marc
 
Reply With Quote
 
Ken Foskey
Guest
Posts: n/a
 
      7th Jul 2008
On Mon, 07 Jul 2008 15:51:51 +0100, Marc Gravell wrote:

> AcceptChanges says "this object doesn't need updating", which is the
> exact opposite of what you want. Try removing this line.


OK I totally misread that one. I now have data writing back.

Ta
Ken
 
Reply With Quote
 
Ken Foskey
Guest
Posts: n/a
 
      7th Jul 2008
On Tue, 08 Jul 2008 01:02:59 +1000, Ken Foskey wrote:

> On Mon, 07 Jul 2008 15:51:51 +0100, Marc Gravell wrote:
>
>> AcceptChanges says "this object doesn't need updating", which is the
>> exact opposite of what you want. Try removing this line.

>
> OK I totally misread that one. I now have data writing back.


OK it works in one application and not another. The only difference that
I can see is that the one that is working has a navigator in it and I
deleted it out of the second. Is there something that the navigator does?

Ta
Ken
 
Reply With Quote
 
Ken Foskey
Guest
Posts: n/a
 
      8th Jul 2008

I found the problem, it is all working now.

Thanks for your help
Ken
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Update Excel Database via Access Main Database with a script Finnbar Microsoft Excel New Users 2 3rd Nov 2008 07:24 PM
Script to Update a Excel Database whenever a Access Database is mo Finnbar Microsoft Access 5 3rd Nov 2008 06:03 PM
Using Excel as a database and need macro or vba to take data entered on one tab and update the database by adding to the next avail row rjr Microsoft Excel Programming 5 11th Jun 2006 09:43 PM
DATA UPDATE FROM CLIENT SIDE DATABASE TO WEB-SERVER DATABASE http://www.visual-basic-data-mining.net/forum Microsoft Access 0 23rd Sep 2004 03:35 PM
Executing UPDATE SQL command doesnot update the database immediately. Venu Koduru Microsoft Access 1 8th Sep 2003 09:54 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:53 PM.