Datatable updating pb...

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

    Datatable updating pb...

    Hello,

    I modifie one row of a datatable
    with this code

    DataRow drCurent = _dsDowntime.Tab les["PPE_DOWNTI ME"].Rows[numRow];
    drCurent.BeginE dit();
    drCurent["Automatic"]=txbCAuto.Text;
    drCurent["DowntimeSt art"]=txbbeg.Text;
    drCurent["DowntimeEn d"]=txbEnd.Text;
    drCurent.EndEdi t();

    but i can't see any change when i reload the data
    even if i ask for their current state

    Any help please
    Franck
  • Eliyahu Goldin

    #2
    Re: Datatable updating pb...

    Franck,

    EndEdit doesn't save data to the database, it just ends the edit occuring on
    the row.

    Eliyahu

    "fh" <fh@fh.com> wrote in message news:de24o2$ad8 $1@s1.news.olea ne.net...[color=blue]
    > Hello,
    >
    > I modifie one row of a datatable
    > with this code
    >
    > DataRow drCurent = _dsDowntime.Tab les["PPE_DOWNTI ME"].Rows[numRow];
    > drCurent.BeginE dit();
    > drCurent["Automatic"]=txbCAuto.Text;
    > drCurent["DowntimeSt art"]=txbbeg.Text;
    > drCurent["DowntimeEn d"]=txbEnd.Text;
    > drCurent.EndEdi t();
    >
    > but i can't see any change when i reload the data
    > even if i ask for their current state
    >
    > Any help please
    > Franck[/color]


    Comment

    • fh

      #3
      Re: Datatable updating pb...

      thanks for your answer
      but when I wrote, reload the data,
      I meant from the dataset modified (apprently not...)

      Eliyahu Goldin wrote:[color=blue]
      > Franck,
      >
      > EndEdit doesn't save data to the database, it just ends the edit occuring on
      > the row.
      >
      > Eliyahu
      >
      > "fh" <fh@fh.com> wrote in message news:de24o2$ad8 $1@s1.news.olea ne.net...
      >[color=green]
      >>Hello,
      >>
      >>I modifie one row of a datatable
      >>with this code
      >>
      >>DataRow drCurent = _dsDowntime.Tab les["PPE_DOWNTI ME"].Rows[numRow];
      >>drCurent.Begi nEdit();
      >>drCurent["Automatic"]=txbCAuto.Text;
      >>drCurent["DowntimeSt art"]=txbbeg.Text;
      >>drCurent["DowntimeEn d"]=txbEnd.Text;
      >>drCurent.EndE dit();
      >>
      >>but i can't see any change when i reload the data
      >>even if i ask for their current state
      >>
      >>Any help please
      >>Franck[/color]
      >
      >
      >[/color]

      Comment

      • Eliyahu Goldin

        #4
        Re: Datatable updating pb...

        You lneed to call AcceptChanges method on either DataRow or DataTable or
        DataSet.

        The following is from the MSDN Library topic:

        You can confirm edits by calling EndEdit or you can cancel them by calling
        CancelEdit. Note that while EndEdit does confirm your edits, the DataSet
        does not actually accept the changes until AcceptChanges is called. Note
        also that if you call AcceptChanges before you have ended the edit with
        EndEdit or CancelEdit, the edit is ended and the Proposed row values are
        accepted for both the Current and Original row versions. In the same manner,
        calling RejectChanges ends the edit and discards the Current and Proposed
        row versions. Calling EndEdit or CancelEdit after calling AcceptChanges or
        RejectChanges has no effect because the edit has already ended.


        Eliyahu

        "fh" <fh@fh.com> wrote in message news:de26ko$b97 $3@s1.news.olea ne.net...[color=blue]
        > thanks for your answer
        > but when I wrote, reload the data,
        > I meant from the dataset modified (apprently not...)
        >
        > Eliyahu Goldin wrote:[color=green]
        > > Franck,
        > >
        > > EndEdit doesn't save data to the database, it just ends the edit[/color][/color]
        occuring on[color=blue][color=green]
        > > the row.
        > >
        > > Eliyahu
        > >
        > > "fh" <fh@fh.com> wrote in message[/color][/color]
        news:de24o2$ad8 $1@s1.news.olea ne.net...[color=blue][color=green]
        > >[color=darkred]
        > >>Hello,
        > >>
        > >>I modifie one row of a datatable
        > >>with this code
        > >>
        > >>DataRow drCurent = _dsDowntime.Tab les["PPE_DOWNTI ME"].Rows[numRow];
        > >>drCurent.Begi nEdit();
        > >>drCurent["Automatic"]=txbCAuto.Text;
        > >>drCurent["DowntimeSt art"]=txbbeg.Text;
        > >>drCurent["DowntimeEn d"]=txbEnd.Text;
        > >>drCurent.EndE dit();
        > >>
        > >>but i can't see any change when i reload the data
        > >>even if i ask for their current state
        > >>
        > >>Any help please
        > >>Franck[/color]
        > >
        > >
        > >[/color][/color]


        Comment

        • fh

          #5
          Re: Datatable updating pb...

          Eliyahu Goldin wrote:[color=blue]
          > You lneed to call AcceptChanges method on either DataRow or DataTable or
          > DataSet.
          >[color=green][color=darkred]
          >>>>DataRow drCurent = _dsDowntime.Tab les["PPE_DOWNTI ME"].Rows[numRow];
          >>>>drCurent.Be ginEdit();
          >>>>drCurent["Automatic"]=txbCAuto.Text;
          >>>>drCurent["DowntimeSt art"]=txbbeg.Text;
          >>>>drCurent["DowntimeEn d"]=txbEnd.Text;
          >>>>drCurent.En dEdit();[/color][/color][/color]

          thanks for your answer
          I have added the folowing line to my code

          drCurent.Accept Changes();
          bool test = _dsDowntime.Has Changes();

          test returned false....


          [color=blue]
          > The following is from the MSDN Library topic:
          >
          > You can confirm edits by calling EndEdit or you can cancel them by calling
          > CancelEdit. Note that while EndEdit does confirm your edits, the DataSet
          > does not actually accept the changes until AcceptChanges is called. Note
          > also that if you call AcceptChanges before you have ended the edit with
          > EndEdit or CancelEdit, the edit is ended and the Proposed row values are
          > accepted for both the Current and Original row versions. In the same manner,
          > calling RejectChanges ends the edit and discards the Current and Proposed
          > row versions. Calling EndEdit or CancelEdit after calling AcceptChanges or
          > RejectChanges has no effect because the edit has already ended.
          >
          >
          > Eliyahu
          >
          > "fh" <fh@fh.com> wrote in message news:de26ko$b97 $3@s1.news.olea ne.net...
          >[color=green]
          >>thanks for your answer
          >>but when I wrote, reload the data,
          >>I meant from the dataset modified (apprently not...)
          >>
          >>Eliyahu Goldin wrote:
          >>[color=darkred]
          >>>Franck,
          >>>
          >>>EndEdit doesn't save data to the database, it just ends the edit[/color][/color]
          >
          > occuring on
          >[color=green][color=darkred]
          >>>the row.
          >>>
          >>>Eliyahu
          >>>
          >>>"fh" <fh@fh.com> wrote in message[/color][/color]
          >
          > news:de24o2$ad8 $1@s1.news.olea ne.net...
          >[color=green][color=darkred]
          >>>>Hello,
          >>>>
          >>>>I modifie one row of a datatable
          >>>>with this code
          >>>>
          >>>>DataRow drCurent = _dsDowntime.Tab les["PPE_DOWNTI ME"].Rows[numRow];
          >>>>drCurent.Be ginEdit();
          >>>>drCurent["Automatic"]=txbCAuto.Text;
          >>>>drCurent["DowntimeSt art"]=txbbeg.Text;
          >>>>drCurent["DowntimeEn d"]=txbEnd.Text;
          >>>>drCurent.En dEdit();
          >>>>
          >>>>but i can't see any change when i reload the data
          >>>>even if i ask for their current state
          >>>>
          >>>>Any help please
          >>>>Franck
          >>>
          >>>
          >>>[/color][/color]
          >
          >[/color]

          Comment

          • Eliyahu Goldin

            #6
            Re: Datatable updating pb...

            Naturally enough. If you check HasChanges() before AcceptChanges() , it
            should return true. AcceptChanges() resets everything as if no changes
            occured. I think, even if you call it for a datarow, it accepts the row
            change all the way up to the dataset.

            Eliyahu

            "fh" <fh@fh.com> wrote in message news:de285v$c2a $3@s1.news.olea ne.net...[color=blue]
            > Eliyahu Goldin wrote:[color=green]
            > > You lneed to call AcceptChanges method on either DataRow or DataTable or
            > > DataSet.
            > >[color=darkred]
            > >>>>DataRow drCurent = _dsDowntime.Tab les["PPE_DOWNTI ME"].Rows[numRow];
            > >>>>drCurent.Be ginEdit();
            > >>>>drCurent["Automatic"]=txbCAuto.Text;
            > >>>>drCurent["DowntimeSt art"]=txbbeg.Text;
            > >>>>drCurent["DowntimeEn d"]=txbEnd.Text;
            > >>>>drCurent.En dEdit();[/color][/color]
            >
            > thanks for your answer
            > I have added the folowing line to my code
            >
            > drCurent.Accept Changes();
            > bool test = _dsDowntime.Has Changes();
            >
            > test returned false....
            >
            >
            >[color=green]
            > > The following is from the MSDN Library topic:
            > >
            > > You can confirm edits by calling EndEdit or you can cancel them by[/color][/color]
            calling[color=blue][color=green]
            > > CancelEdit. Note that while EndEdit does confirm your edits, the DataSet
            > > does not actually accept the changes until AcceptChanges is called. Note
            > > also that if you call AcceptChanges before you have ended the edit with
            > > EndEdit or CancelEdit, the edit is ended and the Proposed row values are
            > > accepted for both the Current and Original row versions. In the same[/color][/color]
            manner,[color=blue][color=green]
            > > calling RejectChanges ends the edit and discards the Current and[/color][/color]
            Proposed[color=blue][color=green]
            > > row versions. Calling EndEdit or CancelEdit after calling AcceptChanges[/color][/color]
            or[color=blue][color=green]
            > > RejectChanges has no effect because the edit has already ended.
            > >
            > >
            > > Eliyahu
            > >
            > > "fh" <fh@fh.com> wrote in message[/color][/color]
            news:de26ko$b97 $3@s1.news.olea ne.net...[color=blue][color=green]
            > >[color=darkred]
            > >>thanks for your answer
            > >>but when I wrote, reload the data,
            > >>I meant from the dataset modified (apprently not...)
            > >>
            > >>Eliyahu Goldin wrote:
            > >>
            > >>>Franck,
            > >>>
            > >>>EndEdit doesn't save data to the database, it just ends the edit[/color]
            > >
            > > occuring on
            > >[color=darkred]
            > >>>the row.
            > >>>
            > >>>Eliyahu
            > >>>
            > >>>"fh" <fh@fh.com> wrote in message[/color]
            > >
            > > news:de24o2$ad8 $1@s1.news.olea ne.net...
            > >[color=darkred]
            > >>>>Hello,
            > >>>>
            > >>>>I modifie one row of a datatable
            > >>>>with this code
            > >>>>
            > >>>>DataRow drCurent = _dsDowntime.Tab les["PPE_DOWNTI ME"].Rows[numRow];
            > >>>>drCurent.Be ginEdit();
            > >>>>drCurent["Automatic"]=txbCAuto.Text;
            > >>>>drCurent["DowntimeSt art"]=txbbeg.Text;
            > >>>>drCurent["DowntimeEn d"]=txbEnd.Text;
            > >>>>drCurent.En dEdit();
            > >>>>
            > >>>>but i can't see any change when i reload the data
            > >>>>even if i ask for their current state
            > >>>>
            > >>>>Any help please
            > >>>>Franck
            > >>>
            > >>>
            > >>>[/color]
            > >
            > >[/color][/color]


            Comment

            Working...