Cannot update database

  • Thread starter Thread starter Ken Foskey
  • Start date Start date
K

Ken Foskey

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
 
AcceptChanges says "this object doesn't need updating", which is the
exact opposite of what you want. Try removing this line.

Marc
 
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
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top