Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Retrieve a cells value before it was changed

Retrieve a cells value before it was changed

Scheduled Pinned Locked Moved C#
databasehelpannouncement
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    Glen Harvy 0
    wrote on last edited by
    #1

    Hi, I have a table "Inventory" that has ID, ItemNumber, Description etc fields and the user can edit these via a datagrid. The ItemNumber is also used in another table "SalesHistory". What I want to do is update the ItemNumber in "SalesHistory" once the user has elected to do so before saving the ItemNumber change in the "Inventory" table to the database. The problem I am having is determining the "old" value so I can update the "SalesHistory" table. I don't want to call the database again to find the old value by matching ID's but it seems I have no alternative. Suggestions please ...

    Glen Harvy

    A 1 Reply Last reply
    0
    • G Glen Harvy 0

      Hi, I have a table "Inventory" that has ID, ItemNumber, Description etc fields and the user can edit these via a datagrid. The ItemNumber is also used in another table "SalesHistory". What I want to do is update the ItemNumber in "SalesHistory" once the user has elected to do so before saving the ItemNumber change in the "Inventory" table to the database. The problem I am having is determining the "old" value so I can update the "SalesHistory" table. I don't want to call the database again to find the old value by matching ID's but it seems I have no alternative. Suggestions please ...

      Glen Harvy

      A Offline
      A Offline
      Anthony Mushrow
      wrote on last edited by
      #2

      Two ideas, check if there is an event for just before an something is changed (i know text boxes have it :rolleyes:) and do everything there (you can see what the new value is from the eventargs). Or make a custom control that inherits a datagrid, and if you can, override the part where items are updated. Sorry if i'm a little vague, but im off to bed, up early tomorrow :(( :zzz:

      G 1 Reply Last reply
      0
      • A Anthony Mushrow

        Two ideas, check if there is an event for just before an something is changed (i know text boxes have it :rolleyes:) and do everything there (you can see what the new value is from the eventargs). Or make a custom control that inherits a datagrid, and if you can, override the part where items are updated. Sorry if i'm a little vague, but im off to bed, up early tomorrow :(( :zzz:

        G Offline
        G Offline
        Glen Harvy 0
        wrote on last edited by
        #3

        There's no obvious event that I can find (eg cellEnter) so I can store the value before it's changed. Goodnight and thanks for your suggestions :cool:

        Glen Harvy

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups