HighTechTalks DotNet Forums  

Transaction Problem

Dotnet Framework (Component Services) microsoft.public.dotnet.framework.component_services


Discuss Transaction Problem in the Dotnet Framework (Component Services) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Suman Ghosh via DotNetMonster.com
 
Posts: n/a

Default Transaction Problem - 04-16-2005 , 01:04 AM






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

Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.