disapearing record

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ken Foskey

    disapearing record


    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 .tblBallBinding Source.AddNew() ;
    newRow.BeginEdi t();
    detDataSet.tblB allRow ball = (detDataSet.tbl BallRow)newRow. Row;
    ball.Timestamp = DateTime.Now;
    ....

    // row exists here.

    newRow.EndEdit( );

    // it is now gone.
  • Ignacio Machin ( .NET/ C# MVP )

    #2
    Re: disapearing record

    On Jul 22, 10:33 am, Ken Foskey <rmove.fos...@o ptushome.com.au wrote:
    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 .tblBallBinding Source.AddNew() ;
    newRow.BeginEdi t();
    detDataSet.tblB allRow ball = (detDataSet.tbl BallRow)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?

    Comment

    • Ken Foskey

      #3
      Re: disapearing record

      On Tue, 22 Jul 2008 07:43:55 -0700, Ignacio Machin ( .NET/ C# MVP ) wrote:
      On Jul 22, 10:33 am, Ken Foskey <rmove.fos...@o ptushome.com.au wrote:
      >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 .tblBallBinding Source.AddNew() ;
      >newRow.BeginEd it();
      >detDataSet.tbl BallRow ball = (detDataSet.tbl BallRow)newRow. Row;
      >ball.Timesta mp = 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?
      Yes. How?

      The Datasource is directly attached to a filled table adaptor.

      Comment

      • Ken Foskey

        #4
        Re: disapearing record

        On Wed, 23 Jul 2008 00:52:23 +1000, Ken Foskey wrote:
        On Tue, 22 Jul 2008 07:43:55 -0700, Ignacio Machin ( .NET/ C# MVP )
        wrote:
        >
        >On Jul 22, 10:33 am, Ken Foskey <rmove.fos...@o ptushome.com.au wrote:
        >>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 .tblBallBinding Source.AddNew() ;
        >>newRow.BeginE dit();
        >>detDataSet.tb lBallRow ball = (detDataSet.tbl BallRow)newRow. Row;
        >>ball.Timestam p = DateTime.Now;
        >>...
        >>>
        >>// row exists here.
        >>>
        >>newRow.EndEdi t();
        >>>
        >>// 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?
        >
        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

        Comment

        Working...