Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Component Services / April 2005

Tip: Looking for answers? Try searching our database.

Transaction Problem

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Suman Ghosh - 16 Apr 2005 06:04 GMT
I need help.

Errors:
1) System.Data.SqlClient.SqlException: Distributed transaction completed.
Either enlist this session in a new transaction or the NULL transaction.

2) System.Runtime.InteropServices.COMException (0x8004D00E): Exception from
HRESULT: 0x8004D00E.
------------------------------------------------------------------------
Code Attached
=============

Try
   objSqlCon.Open()
   objTransaction = objSqlCon.BeginTransaction
   objCom.Transaction = objTransaction

   
   'Inserts a Campaign in a table and returns the identity.
   '=======================================
   objCom.CommandType = CommandType.StoredProcedure
   objCom.CommandText = "MDTS_INSERT_CAMPAIGN"
   dr = objCom.ExecuteReader()

   If (dr.Read()) Then
    decInserted_Camp_ID = dr.GetDecimal(0)
    emailId = "admin" & decInserted_Camp_ID.ToString
   End If
   dr.Close()

   If (Not strURL.Trim = "") Then
    'Inserts come more data in another table.
    '=============================
    objCom.CommandType = CommandType.StoredProcedure
    objCom.CommandText = "MDTS_INSERT_CAMPAIGN_URL"
    objCom.ExecuteNonQuery()
   End If

   'Storing file attachment content as an array of byte
   '===================================================
   If (strAttachFileName.Equals("") = False) Then
    Try
       'Inserts Some attachment/binary data in another table
       '======================================
       objCom.CommandText = "MDTS_INSERT_ITEM"
       objCom.CommandType = CommandType.StoredProcedure
       objCom.ExecuteNonQuery()
    Catch Exc As Exception
       'Error Logging
       '==========
       Dim objLog As New MdtsErrorLog()
       objLog.LogError("FrontDesk", "clsViewCampaignOrder" & vbNewLine &
"decInsertCampaignOrder() Exception [Inner]: " & vbNewLine & Exc.ToString)
       objLog = Nothing
    End Try
   End If
   '==================================

   objJmail.Domain = DomainName
   objJmail.bl_createPOP(emailId)
   'Logging pop mail creation
   '==================

   'ADDED FOR CREATING THE MAIL ACCOUNT  
   'Adding new list of Recipients for the current campaign
   '======================================
   doc.LoadXml(strXML4Recipients)
   node = doc.DocumentElement
   nodelist = node.SelectNodes("/MDTS/MdtsCampaign/Recipients/Recipient")

   'Inserts Mail Recipients Data in another table in loop
   '=====================================
   For intCounter = 0 To nodelist.Count - 1
    If (IsNothing(nodelist(intCounter).Attributes("To")) = False) Then
       strEMailID = nodelist(intCounter).Attributes("To").Value
       strTempXML4Recipient = "<MDTS><MdtsCampaign><Recipients>"
       strTempXML4Recipient = strTempXML4Recipient & nodelist(intCounter)
.OuterXml
       strTempXML4Recipient = strTempXML4Recipient &
"</Recipients></MdtsCampaign></MDTS>"

       objCom.CommandType = CommandType.StoredProcedure
       objCom.CommandText = "MDTS_INSERT_RECIPIENTS"
       objCom.ExecuteNonQuery()
    End If
   Next

   'Finally Commits
   '===========
   objTransaction.Commit()
   Return decInserted_Camp_ID
Catch Exc As Exception
   'InCase of Error, calls for a Rollback
   '=========================
   objTransaction.Rollback()
   
   'Error Logging
   '==========
   Dim objLog As New MdtsErrorLog()
   objLog.LogError("FrontDesk", "clsViewCampaignOrder" & vbNewLine &
"decInsertCampaignOrder() Exception [Outer]: " & vbNewLine & Exc.ToString)
   objLog = Nothing
   Return 0
Finally
   objTransaction.Dispose()
   dr.Close()
   objCom.Dispose()
   objSqlCon.Close()
   objSqlCon.Dispose()
   dr = Nothing
   objJmail = Nothing
   objTransaction = Nothing
   node = Nothing
   nodelist = Nothing
   doc = Nothing
   objCom = Nothing
   objSqlCon = Nothing
End Try
Gabriel Lozano-Morán - 18 Apr 2005 19:53 GMT
Different layers? Enterprise services? .NET remoting? ASP.NET frontend?

Give us more info please :)

Gabriel Lozano-Morán
Software Engineer
Sogeti

>I need help.
>
[quoted text clipped - 114 lines]
>    objSqlCon = Nothing
> End Try

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.