Transactions not working in CE

Posts   
 
    
David H
User
Posts: 100
Joined: 31-Dec-2004
# Posted on: 16-Sep-2008 05:45:41   

Below is a short code from an application running against SQL CE 3.5SP1 with LLBLGEN 2.6 using adapter.

I passed a parameter to the call 'testRollback = True' and verified that the roll back was called (I am calling this using COM...) based on the return message.

Yet, the record found itself into the database.

Please help.

Thanks

David


    ' start the transaction
    adapter.StartTransaction(System.Data.IsolationLevel.ReadCommitted, tanscationName)

    Try

      ' check if saving core.
      If Not core.Save Then

        _saveOutcomeMessage = "Failed saving core."
        adapter.Rollback()
        Return False

      End If

      If testRollback Then
        _saveOutcomeMessage = "Rolledback core inventory."
        adapter.Rollback()
        Return False
      End If

      If adapter.SaveEntity(_entity) Then

        adapter.Commit()
        Return True

      Else

        _saveOutcomeMessage = "Failed saving proof."
        adapter.Rollback()
        Return False

      End If

    Catch ex As Exception

      _saveOutcomeMessage = ex.ToString
      adapter.Rollback()
      Return False

    Finally

      adapter.Dispose()
      adapter = Nothing

    End Try

David H
User
Posts: 100
Joined: 31-Dec-2004
# Posted on: 16-Sep-2008 06:46:34   

Here I go again -- problem solved -- my apologies.

I guess I get inspired to figure out a fix to my bugs right after reporting them on the forum simple_smile

The problem was due to my instantiating a new adapter as part of the call to core.save().

The transactions work like a charm.

Thanks for a super great, and I can say with confidence, robust tool.

David