Mark a DataTable dirty

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

    #1

    Mark a DataTable dirty

    Hi;

    How can I mark a DataTable as dirty (has changes)? I need
    to do this because when I add a DataColumn to a
    DataTable, it does not set HasChanges() to true.

    thanks - dave
  • Miha Markic

    #2
    Re: Mark a DataTable dirty

    Hi David,

    DataTable itself doen't have a dirty property.
    Instead, every row has RowState property which marks the row state.
    If you want to mark all rows as changed you might loop through all of them
    and set one of the fields to the same value.
    BTW, what are you trying to achieve?

    --
    Miha Markic - RightHand .NET consulting & development
    miha at rthand com

    "David Thielen" <dave@windward. net> wrote in message
    news:02b601c3aa 11$bac53c40$a10 1280a@phx.gbl.. .[color=blue]
    > Hi;
    >
    > How can I mark a DataTable as dirty (has changes)? I need
    > to do this because when I add a DataColumn to a
    > DataTable, it does not set HasChanges() to true.
    >
    > thanks - dave[/color]


    Comment

    • David Thielen

      #3
      Re: Mark a DataTable dirty

      I've found that when I programatically add a column - it
      still returns false for HasChanges(). So in that case I
      need to have a way to force HasChanges() to return true
      after the column insertion.

      I assume the way to handle this is do:
      if (table.Row[0].DataState == DataRowState.Un changed)
      table.Row[0].DataState = DataRowState.Mo dified;


      thanks - dave

      [color=blue]
      >-----Original Message-----
      >Hi David,
      >
      >DataTable itself doen't have a dirty property.
      >Instead, every row has RowState property which marks the[/color]
      row state.[color=blue]
      >If you want to mark all rows as changed you might loop[/color]
      through all of them[color=blue]
      >and set one of the fields to the same value.
      >BTW, what are you trying to achieve?
      >
      >--
      >Miha Markic - RightHand .NET consulting & development
      >miha at rthand com
      >
      >"David Thielen" <dave@windward. net> wrote in message
      >news:02b601c3a a11$bac53c40$a1 01280a@phx.gbl. ..[color=green]
      >> Hi;
      >>
      >> How can I mark a DataTable as dirty (has changes)? I[/color][/color]
      need[color=blue][color=green]
      >> to do this because when I add a DataColumn to a
      >> DataTable, it does not set HasChanges() to true.
      >>
      >> thanks - dave[/color]
      >
      >
      >.[/color]

      Comment

      • Guest's Avatar

        #4
        Re: Mark a DataTable dirty

        That doesn't work - DataState is get only.

        Any ideas how to set this?

        thanks - dave

        [color=blue]
        >-----Original Message-----
        >I've found that when I programatically add a column - it
        >still returns false for HasChanges(). So in that case I
        >need to have a way to force HasChanges() to return true
        >after the column insertion.
        >
        >I assume the way to handle this is do:
        >if (table.Row[0].DataState == DataRowState.Un changed)
        >table.Row[0].DataState = DataRowState.Mo dified;
        >
        >
        >thanks - dave
        >
        >[color=green]
        >>-----Original Message-----
        >>Hi David,
        >>
        >>DataTable itself doen't have a dirty property.
        >>Instead, every row has RowState property which marks[/color][/color]
        the[color=blue]
        >row state.[color=green]
        >>If you want to mark all rows as changed you might loop[/color]
        >through all of them[color=green]
        >>and set one of the fields to the same value.
        >>BTW, what are you trying to achieve?
        >>
        >>--
        >>Miha Markic - RightHand .NET consulting & development
        >>miha at rthand com
        >>
        >>"David Thielen" <dave@windward. net> wrote in message
        >>news:02b601c3 aa11$bac53c40$a 101280a@phx.gbl ...[color=darkred]
        >>> Hi;
        >>>
        >>> How can I mark a DataTable as dirty (has changes)? I[/color][/color]
        >need[color=green][color=darkred]
        >>> to do this because when I add a DataColumn to a
        >>> DataTable, it does not set HasChanges() to true.
        >>>
        >>> thanks - dave[/color]
        >>
        >>
        >>.[/color]
        >
        >.
        >[/color]

        Comment

        • David Thielen

          #5
          How can I mark a DataTable dirty


          Hi asking again...

          [color=blue]
          >That doesn't work - DataState is get only.
          >
          >Any ideas how to set this?
          >
          >thanks - dave
          >
          >[color=green]
          >>-----Original Message-----
          >>I've found that when I programatically add a column - it
          >>still returns false for HasChanges(). So in that case I
          >>need to have a way to force HasChanges() to return true
          >>after the column insertion.
          >>
          >>I assume the way to handle this is do:
          >>if (table.Row[0].DataState == DataRowState.Un changed)
          >>table.Row[0].DataState = DataRowState.Mo dified;
          >>
          >>
          >>thanks - dave
          >>
          >>[color=darkred]
          >>>-----Original Message-----
          >>>Hi David,
          >>>
          >>>DataTable itself doen't have a dirty property.
          >>>Instead, every row has RowState property which marks[/color][/color]
          >the[color=green]
          >>row state.[color=darkred]
          >>>If you want to mark all rows as changed you might loop[/color]
          >>through all of them[color=darkred]
          >>>and set one of the fields to the same value.
          >>>BTW, what are you trying to achieve?
          >>>
          >>>--
          >>>Miha Markic - RightHand .NET consulting & development
          >>>miha at rthand com
          >>>
          >>>"David Thielen" <dave@windward. net> wrote in message
          >>>news:02b601c 3aa11$bac53c40$ a101280a@phx.gb l...
          >>>> Hi;
          >>>>
          >>>> How can I mark a DataTable as dirty (has changes)? I[/color]
          >>need[color=darkred]
          >>>> to do this because when I add a DataColumn to a
          >>>> DataTable, it does not set HasChanges() to true.
          >>>>
          >>>> thanks - dave[/color][/color][/color]

          Comment

          Working...