Datatable updating pbs.

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

    Datatable updating pbs.

    Hello,

    I modify one row of a datatable
    with this code

    DataRow drCurrent = _dsDowntime.Tab les["PPE_DOWNTI ME"].Rows[numRow];
    drCurrent.Begin Edit();
    drCurrent["Automatic"]=txbCAuto.Text;
    drCurrent["DowntimeSt art"]=txbbeg.Text;
    drCurrent["DowntimeEn d"]=txbEnd.Text;
    drCurrent.EndEd it();

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

    Franck
  • Nicholas Paldino [.NET/C# MVP]

    #2
    Re: Datatable updating pbs.

    Franck,

    Calling BeginEdit and EndEdit doesn't commit the changes to the
    database. The DataSet is disconnected, meaning that the data you have in
    the DataSet is not connected to the database it came from in any way.

    In order to update the records, you have to pass the dataset to a
    DataAdapter (preferably, the one you used to select the data) through the
    Update method.

    Hope this helps.


    --
    - Nicholas Paldino [.NET/C# MVP]
    - mvp@spam.guard. caspershouse.co m

    "fh" <fh@fh.com> wrote in message news:de268r$b97 $1@s1.news.olea ne.net...[color=blue]
    > Hello,
    >
    > I modify one row of a datatable
    > with this code
    >
    > DataRow drCurrent = _dsDowntime.Tab les["PPE_DOWNTI ME"].Rows[numRow];
    > drCurrent.Begin Edit();
    > drCurrent["Automatic"]=txbCAuto.Text;
    > drCurrent["DowntimeSt art"]=txbbeg.Text;
    > drCurrent["DowntimeEn d"]=txbEnd.Text;
    > drCurrent.EndEd it();
    >
    > but i can't see any change when I reload the data
    > even if i request for their current state
    >
    > Franck[/color]


    Comment

    • fh

      #3
      Re: Datatable updating pbs.

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

      Nicholas Paldino [.NET/C# MVP] wrote:[color=blue]
      > Franck,
      >
      > Calling BeginEdit and EndEdit doesn't commit the changes to the
      > database. The DataSet is disconnected, meaning that the data you have in
      > the DataSet is not connected to the database it came from in any way.
      >
      > In order to update the records, you have to pass the dataset to a
      > DataAdapter (preferably, the one you used to select the data) through the
      > Update method.
      >
      > Hope this helps.
      >
      >[/color]

      Comment

      • Nicholas Paldino [.NET/C# MVP]

        #4
        Re: Datatable updating pbs.

        fh,

        If you change a value on a column in a row, then the row state of the
        row should change automatically.

        Are you filtering on the rowstate perhaps and you don't know it?

        --
        - Nicholas Paldino [.NET/C# MVP]
        - mvp@spam.guard. caspershouse.co m

        "fh" <fh@fh.com> wrote in message news:de26ms$b97 $4@s1.news.olea ne.net...[color=blue]
        > thanks for your answer
        > but when I wrote, reload the data,
        > I meant from the dataset modified (apparently not...)
        >
        > Nicholas Paldino [.NET/C# MVP] wrote:[color=green]
        >> Franck,
        >>
        >> Calling BeginEdit and EndEdit doesn't commit the changes to the
        >> database. The DataSet is disconnected, meaning that the data you have in
        >> the DataSet is not connected to the database it came from in any way.
        >>
        >> In order to update the records, you have to pass the dataset to a
        >> DataAdapter (preferably, the one you used to select the data) through the
        >> Update method.
        >>
        >> Hope this helps.
        >>[/color][/color]

        Comment

        • fh

          #5
          Re: Datatable updating pbs.

          Nicholas Paldino [.NET/C# MVP] wrote:[color=blue]
          > fh,
          >
          > If you change a value on a column in a row, then the row state of the
          > row should change automatically.
          >
          > Are you filtering on the rowstate perhaps and you don't know it?
          >[/color]
          thank you for your answer,
          in fact no
          to view my data i use:

          txbDate.Text=
          drLigneCourante["ValidationDate ",DataRowVersio n.Current].ToString();

          so the state is current

          Comment

          Working...