Transaction and RowState problem

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

    Transaction and RowState problem

    Hi all
    I have a master detail table which I use them in Transaction to Update them.
    in some cases the detail table generates error and I Rollback transaction
    but RowState of master table dosen't go back to previous state and no data
    has entered in database yet but in my master table in memory it has data..
    ????
    how can I change RowState of master table to previous RowState before
    begining Save.

    thanks in advance



  • Dave Sexton

    #2
    Re: Transaction and RowState problem

    Hi,

    Try calling DataRow.RejectC hanges().

    --
    Dave Sexton

    "perspolis" <rezarms@hotmai l.comwrote in message
    news:u7j1cgc$GH A.3536@TK2MSFTN GP04.phx.gbl...
    Hi all
    I have a master detail table which I use them in Transaction to Update them.
    in some cases the detail table generates error and I Rollback transaction
    but RowState of master table dosen't go back to previous state and no data
    has entered in database yet but in my master table in memory it has data..
    ????
    how can I change RowState of master table to previous RowState before
    begining Save.
    >
    thanks in advance
    >
    >
    >

    Comment

    • perspolis

      #3
      Re: Transaction and RowState problem

      I want to keep the data that user has entered..
      In master table after inserting I return the Identity column.
      If I set the UpdatedRowSourc e InsertCommand to UpdateRowSource .None it
      keeps the RowState but dosen't update Identoty column.


      "Dave Sexton" <dave@jwa[remove.this]online.comwrote in message
      news:%23PGO0Cd$ GHA.3380@TK2MSF TNGP04.phx.gbl. ..
      Hi,
      >
      Try calling DataRow.RejectC hanges().
      >
      --
      Dave Sexton
      >
      "perspolis" <rezarms@hotmai l.comwrote in message
      news:u7j1cgc$GH A.3536@TK2MSFTN GP04.phx.gbl...
      >Hi all
      >I have a master detail table which I use them in Transaction to Update
      >them.
      >in some cases the detail table generates error and I Rollback transaction
      >but RowState of master table dosen't go back to previous state and no
      >data
      >has entered in database yet but in my master table in memory it has
      >data..
      >????
      >how can I change RowState of master table to previous RowState before
      >begining Save.
      >>
      >thanks in advance
      >>
      >>
      >>
      >
      >
      >

      Comment

      • Dave Sexton

        #4
        Re: Transaction and RowState problem

        Hi,

        In the 2.0 framework you can just call the SetAdded() method on the master
        DataRow to return its RowState back to Added, if an error occurs.

        In earlier versions of the framework you'll have to remove the row and then
        add it back again, AFAIK. In that case check out the DataTable.LoadD ataRow()
        method and DataRow.ItemArr ay property.

        In either case, setting UpdatedRowSourc e to None isn't really necessary,
        unless you have referenced the AutoNumber value somewhere else and it needs to
        be preserved. Instead, you can explicitly set the detail row's foreign key to
        the new value of the primary key in the master record (returned by the
        database) after resetting the master RowState to Added.

        --
        Dave Sexton

        "perspolis" <rezarms@hotmai l.comwrote in message
        news:%23wer$9j$ GHA.4604@TK2MSF TNGP02.phx.gbl. ..
        >I want to keep the data that user has entered..
        In master table after inserting I return the Identity column.
        If I set the UpdatedRowSourc e InsertCommand to UpdateRowSource .None it
        keeps the RowState but dosen't update Identoty column.
        >
        >
        "Dave Sexton" <dave@jwa[remove.this]online.comwrote in message
        news:%23PGO0Cd$ GHA.3380@TK2MSF TNGP04.phx.gbl. ..
        >Hi,
        >>
        >Try calling DataRow.RejectC hanges().
        >>
        >--
        >Dave Sexton
        >>
        >"perspolis" <rezarms@hotmai l.comwrote in message
        >news:u7j1cgc$G HA.3536@TK2MSFT NGP04.phx.gbl.. .
        >>Hi all
        >>I have a master detail table which I use them in Transaction to Update
        >>them.
        >>in some cases the detail table generates error and I Rollback transaction
        >>but RowState of master table dosen't go back to previous state and no data
        >>has entered in database yet but in my master table in memory it has data..
        >>????
        >>how can I change RowState of master table to previous RowState before
        >>begining Save.
        >>>
        >>thanks in advance
        >>>
        >>>
        >>>
        >>
        >>
        >>
        >
        >

        Comment

        Working...