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. Database & SysAdmin
  3. Database
  4. insert record in two database

insert record in two database

Scheduled Pinned Locked Moved Database
databasecsharpsql-serversysadmintutorial
2 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.
  • A Offline
    A Offline
    Amit Agarrwal
    wrote on last edited by
    #1

    hello all, My application in windows C#. i have two database in sql server 2005. i want to insert record in both database but the major concern is that if any one failed its transaction then it should rollback both trasaction in both databases. please guide me for this.....

    Amit Agarwal

    W 1 Reply Last reply
    0
    • A Amit Agarrwal

      hello all, My application in windows C#. i have two database in sql server 2005. i want to insert record in both database but the major concern is that if any one failed its transaction then it should rollback both trasaction in both databases. please guide me for this.....

      Amit Agarwal

      W Offline
      W Offline
      Wendelius
      wrote on last edited by
      #2

      Amit Agarrwal wrote:

      want to insert record in both database but the major concern is that if any one failed its transaction then it should rollback both trasaction in both databases

      This is called distributed transaction where you have a special coordinator which takes care of the transactions. The transactions themselves are ended using two-phase commit. You could start here: http://msdn.microsoft.com/en-us/library/ms191440.aspx[^] A slightly different variation is using Linked Servers.

      Amit Agarrwal wrote:

      i have two database in sql server 2005

      Just wondering what that actually means. If you have two different SQL Server instances, then you need to distribute the transaction (one way or another), but if you have two different databases inside a single SQL Server instance, you can use normal transactions.

      The need to optimize rises from a bad design.My articles[^]

      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