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. Web Development
  3. ASP.NET
  4. problem in commit & roll back [modified]

problem in commit & roll back [modified]

Scheduled Pinned Locked Moved ASP.NET
helpdatabaseannouncement
1 Posts 1 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
    micydon
    wrote on last edited by
    #1

    Hi anybody pls help me its very urgent I am facing a problem while doing commit & roll back in one of my pages. My problem is i have to upload data from one database(accounts) to another say Gaccounts programmatically. In my web.config i wrote 2 connections by name con(for database accounts), con1(for Database-Gaccounts). Then in my program i am using commit & roll back. I have to check the code from ledger table (say 0003) with code in accounts table if it exist then i have to check whether that code exits in accounts table of gaccounts database. If it is not there I have to add more value in the code like (0003tvm) and then create a row in accounts table of gaccounts database with this new code. This much am not feeling any problem. Now I have to update this new code back in accounts table of accounts database. .here the problem comes if roll back happens then also updating of this code take place Creating complete error .I am giving database details in a class file. In this project I used 2 class files say objdb-representing accounts and objmdb-for gaccounts. ‘This is the code I am using for roll backing Dim objCon1 As New oleDbConnection(ConfigurationSettings.AppSettings.Get("con1")) Dim objCmd As New OleDbCommand Dim objTran As OleDbTransaction objCon1.Open() objTran = objCon1.BeginTransaction objCmd.Connection = objCon1 objCmd.Transaction = objTran Try ****** I have given the code for updating as ******* 'sSQL = " Update accounts set txtmastcode='" & snewcode& "'WHERE txtcode='" & objdr("txtcode") & "'" ireturn=objdb.executenonquerry(ssql,objdb.opendb) objTran.Commit() Catch ex As Exception objTran.Rollback() MessageBox.Show("Transaction failed. Contact Administartor") MessageBox.Show(ex.Message().ToString()) Finally objCon1.Close() objCmd.Dispose() End Try Please anybody help me , this is very urgent. -- modified at 13:25 Wednesday 24th January, 2007

    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