Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is this an MTS error message?

Status
Not open for further replies.

Brice

Programmer
Dec 16, 2000
22
0
0
US
I'm getting the error message, "Cannot start more transactions on this session". Has anyone seen this message? What I have is 2 dll's running in MTS. One contains business rules, the other is strictly data access code. It is the data access code that is giving me this error. I can post code if necessary, but I thought I would see if this is the right forum to ask this question, first.
 
Of course this is a right forum about MTS however if you supply more infomation you will save time to get answer.

The transaction is controlled by MTS itself so you should not manipulate transaction manually.

Hope this helps you! zallen@cmmail.com
Long live of freedom!
 
It is the data access code that is giving me this error

I suspect you might be getting an error of some kind in your data-access layer, which is being caught by an On Error Goto, which does a Resume <label:>, which results in another BeginTrans being executed. IOW, an infinite loop. MTS will only nest transactions so far.

Chip H.
 
Ok, here it goes...

Below is the data access code I mentioned. I know this may be rather lengthy, but in the
interest of brevity and confidentiality, I've modified some of the variable and object
names and omitted things like the creation of the ParamArray from vntParams.
The logic, however, is the same.

The RunSPInTransReturnLong is listed below as well.

The CtxCreateObject function creates (and returns) an MTS ObjectContext object.

GetConnectionString should be obvious. Let me know if I need to provide any further info.

CtxRaiseError calls SetAbort and then raises the error to the calling object.

Also, the CtxCreateObject and CtxRaiseError functions are in a .bas module.


Public Function Save(vntMParams() As Variant, vntEq() As Variant) As Long

On Error GoTo SaveErr:
Dim lngMReturnVal As Long, lngID As Long
Dim blnMPersistSuccessful As Boolean, blnEQPersistSuccessful As Boolean

' Declare variable for the Command object
Dim cmdCommand As ADODB.Command

' Create the ADO Command object
Set cmdCommand = CtxCreateObject(&quot;ADODB.Command&quot;)

'Initialize Persist success flag
blnMPersistSuccessful = False


'Open the Command object's connection and start the transaction
cmdCommand.ActiveConnection = GetConnectionString()
cmdCommand.ActiveConnection.BeginTrans

If vntMParams(15) = True Then
'Adding
lngMReturnVal = RunSPInTransReturnLong(cmdCommand, &quot;InsertSP&quot;, <ParamArray from vntMParams here>)

'Set Persist success flag based on return value from store procedure
'A return value of zero here is a failure
blnMPersistSuccessful = (lngMReturnVal > 0)
Else
'Updating
lngMReturnVal = RunSPInTransReturnLong(cmdCommand, &quot;UpdateSP&quot;, <ParamArray from vntMParams here>)

'Set Persist success flag based on return value from store procedure
'A return value of zero here is a success
blnMPersistSuccessful = (lngMReturnVal = 0)
End If

'If save was unsuccessful, rollback transaction, clean up, and exit
If Not blnMPersistSuccessful Then
Save = lngMReturnVal
cmdCommand.ActiveConnection.RollbackTrans
Set cmdCommand.ActiveConnection = Nothing
Set cmdCommand = Nothing
Exit Function
End If

'If saving a new one, get the ID from the return value of the
'stored procedure call. Otherwise, use the one passed in inside the array.
If vntMParams(15) = True Then
lngID = lngMReturnVal
Else
lngID = vntMParams(23)
End If

If UBound(vntEq, 2) = 0 Then
'No Eq's exist (this is the most likely case)
'Force persist flag to True if there are no Eqs so that the transaction
'can still be committed if the M was persisted successfully
blnEQPersistSuccessful = True
Else
'Eq's exist, save and/or delete them accordingly.
Dim lngIndex As Long, lngEqReturnVal As Long

Set mobjEqPersist = CtxCreateObject(&quot;DATAACCESS.EqPersist&quot;)

'Cycle through Eq array
For lngIndex = 0 To UBound(vntEq)
blnEQPersistSuccessful = False
Select Case UCase(vntEq(lngIndex, 1))
Case &quot;SAVE&quot;
Dim vntSaveArray(2) As Variant
vntSaveArray(0) = lngID
vntSaveArray(1) = vntEq(lngIndex, 0)
'Call stored procedure to save
lngEqReturnVal = mobjEqPersist.Save(cmdCommand, _
vntSaveArray)

'Set Persist success flag based on return value from stored procedure
blnEQPersistSuccessful = (lngEqReturnVal > 0)
Case &quot;DELETE&quot;
Dim vntDeleteArray(2) As Variant
vntDeleteArray(0) = lngID
vntDeleteArray(1) = vntEq(lngIndex, 0)
'Call stored procedure to delete
lngEqReturnVal = mobjEqPersist.Delete(cmdCommand, _
vntDeleteArray)

'Set Persist success flag based on return value from stored procedure
blnEQPersistSuccessful = (lngEqReturnVal = 0)
Case Else
blnEQPersistSuccessful = True
End Select

'Exit the loop if any of the persist activities are unsuccessful
If Not blnEQPersistSuccessful Then
Exit For
End If
Next lngIndex
End If

If blnEQPersistSuccessful Then
'If all Eq persist activities are successful, set return value equal
'to return value from save of M and commit the entire transaction
Save = lngMReturnVal
cmdCommand.ActiveConnection.CommitTrans
Else
If vntMParams(15) = True Then
'Set return value to zero to signify a failure on the
'save of a new M
Save = 0
Else
'Set return value to non-zero to signify a failure on the
'save of a existing M
Save = 1
End If
cmdCommand.ActiveConnection.RollbackTrans
End If

'Cleanup and return
Set cmdCommand.ActiveConnection = Nothing
Set cmdCommand = Nothing

Exit Function
'-------------------------------------------------------------------------------
SaveErr:
Call CtxRaiseError(Err.Number, M_STRMODULENAME & &quot;.Save Method&quot;, _
Err.Description)
End Function
________________________________________________________________________________

Public Function RunSPInTransReturnLong(ByRef cmdCommand As ADODB.Command, _
ByVal strSP As String, ParamArray vntParams() As Variant) As Long


On Error GoTo RunSPInTransReturnLongErr:

' Init the ADO Command object
cmdCommand.CommandText = strSP
cmdCommand.CommandType = adCmdStoredProc

'Clear out Parameters collection before loading again
With cmdCommand.Parameters
If .Count > 0 Then
Dim lngIndex As Long
For lngIndex = .Count - 1 To 0 Step -1
.Delete lngIndex
Next
End If
End With

' Append the parameters to the Command object, Parameters collection
CollectParams cmdCommand, vntParams

' Add another parameter as the last parameter. It is outgoing and named @retval
cmdCommand.Parameters.Append _
cmdCommand.CreateParameter(&quot;@retval&quot;, adInteger, adParamOutput, 4)

' Execute the stored procedure without a resulting recordset and pull out
' the &quot;return value&quot; parameter
cmdCommand.Execute , , ADODB.adExecuteNoRecords
RunSPInTransReturnLong = cmdCommand.Parameters(&quot;@retval&quot;).Value

Exit Function
---
Error handler code...

End Function


WHEW!!! Any help is greatly appreciated.
 
Well, I think I solved the problem. Thanks to both zallen and chiph for the suggestions. It turns out I was trying to nest transactions (probably obvious in my code posting) after all, but I didn't realize that's what the error was telling me.

Thanks again.
 
sir
i would like to know what is this error during insttalation of pws gives
1.updating mts registry entries
2.unkown error occured error code=0x80004005
setup of transaction server core components failed specific error code is 0xfee620
due to this i could not able to run my asp program

giving errors
http 005
http 404 not found
like that can not locate pws
 
ms ratan agarwal,

I'm not sure I can be of any help, but I'll try. Could you explain what 'pws' is? Is this something that happens when you try install components in MTS or does it happen when installing MTS itself?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top