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. split event handler or fire event as two events

split event handler or fire event as two events

Scheduled Pinned Locked Moved C#
questiondatabasehelptutorial
3 Posts 3 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.
  • M Offline
    M Offline
    Mr Kode
    wrote on last edited by
    #1

    hello all... i have logical trouble in my windows application there is one eventHandler (Button1_click) contains two sqlcommands the first sqlcommand insert into parent table (primary key table) the second sqlcommand insert into references table as expected the code generate sql exception because the referial constraint the question is : how to solve this problem without adding new eventHandler and without modifying the tables relation? best regards

    T P 2 Replies Last reply
    0
    • M Mr Kode

      hello all... i have logical trouble in my windows application there is one eventHandler (Button1_click) contains two sqlcommands the first sqlcommand insert into parent table (primary key table) the second sqlcommand insert into references table as expected the code generate sql exception because the referial constraint the question is : how to solve this problem without adding new eventHandler and without modifying the tables relation? best regards

      T Offline
      T Offline
      The Man from U N C L E
      wrote on last edited by
      #2

      You have to return the newly created ID's from the first insert and update your data before sending the second insert. A better solution may be to parcel the whole data set up as xml, pass it into a stored procedure, then you can process the whole lot in one shot.

      If you have knowledge, let others light their candles at it. Margaret Fuller (1810 - 1850) www.JacksonSoft.co.uk

      1 Reply Last reply
      0
      • M Mr Kode

        hello all... i have logical trouble in my windows application there is one eventHandler (Button1_click) contains two sqlcommands the first sqlcommand insert into parent table (primary key table) the second sqlcommand insert into references table as expected the code generate sql exception because the referial constraint the question is : how to solve this problem without adding new eventHandler and without modifying the tables relation? best regards

        P Online
        P Online
        PIEBALDconsult
        wrote on last edited by
        #3

        The application shouldn't know or care about the details; all that should be handled in the Data Access Layer.

        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