disapearing record

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

Ken Foskey

I have a total loss of how to actually add rows to an MS access table.
The addnew creates a row on the table but once EndEdit is called it
disappears. What am I missing.

DataRowView newRow = (DataRowView)DB.tblBallBindingSource.AddNew();
newRow.BeginEdit();
detDataSet.tblBallRow ball = (detDataSet.tblBallRow)newRow.Row;
ball.Timestamp = DateTime.Now;
....

// row exists here.

newRow.EndEdit();

// it is now gone.
 
I have a total loss of how to actually add rows to an MS access table.  
The addnew creates a row on the table but once EndEdit is called it
disappears.   What am I missing.

DataRowView newRow = (DataRowView)DB.tblBallBindingSource.AddNew();
newRow.BeginEdit();
detDataSet.tblBallRow ball = (detDataSet.tblBallRow)newRow.Row;
ball.Timestamp = DateTime.Now;
...

// row exists here.

newRow.EndEdit();

// it is now gone.

You need to save the record back to the DB, your code save it to the
dataset (look at it as an inmemory representation of the dB)
how did you got the data in the first place?
 
You need to save the record back to the DB, your code save it to the
dataset (look at it as an inmemory representation of the dB) how did you
got the data in the first place?

Yes. How?

The Datasource is directly attached to a filled table adaptor.
 
Yes. How?

The Datasource is directly attached to a filled table adaptor.

Finally got to the bottom of this...

My project was set to duplicate the database to the debug directory so
the update was wiped every time. There was also a problem with the keys
that was causing the record to 'disappear' once the EndEdit was run
because it did not match the filter criteria. Two errors leading to
total confusion.

Thanks
Ken
 
Back
Top