PC Review
Forums
Newsgroups
Microsoft DotNet
Microsoft ADO .NET
Connection closes arbitrarily
Forums
Newsgroups
Microsoft DotNet
Microsoft ADO .NET
Connection closes arbitrarily
![]() |
Connection closes arbitrarily |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
I have a problem with a connection arbitrarily closing within my
method. The connection and transaction are created outside this method and several other methods use these prior to this method being called. The connection usually (but not always) persists sufficiently long within this method for a local connection not to be created. The same problem occurs whether I run right through or debug the code. The connection usually closes while populating the data row and an exception is then thrown outside of this method when attempting to commit the transaction. Additional information: An error occured while processing new Dummy requests:This SqlTransaction has completed; it is no longer usable. On occasions where a local connection is created, an exception is thrown when attempting to insert the row since a newly inserted row to another table to which this row has a foreign key is lost from the transaction. I am using mutexes so that other processes should not run while this code is being handled - however, taking the mutex wrapper out from around the call to this process makes no difference on the outcome. Any ideas? Dim blnLocalConnection As Boolean = False Dim blnLocalTransaction As Boolean = False Try If Me.Connection.State = ConnectionState.Closed Then Me.Connection.Open() blnLocalConnection = True End If If Me.Transaction Is Nothing Then Me.Transaction = Me.Connection.BeginTransaction(IsolationLevel.RepeatableRead) blnLocalTransaction = True End If ' Instantiate a new DummyActivateGSMSP31Request object to process the DummyActivateGSMSP31Request details ' Dim objDummyActivateGSMSP31Request As New DummyActivateGSMSP31Request(Me.Connection, Me.Transaction) ' Instantiate a new DummyActivateGSMSP31Request datAset to hold the DummyActivateGSMSP31Request detail rows Dim dstDummyActivateGSMSP31Request As New DummyActivateGSMSP31RequestDataset ' Instantiate a DummyActivateGSMSP31RequestRow to hold the DummyActivateGSMSP31Request details Dim rowDummyActivateGSMSP31Request As DummyActivateGSMSP31RequestDataset.DummyActivateGSMSP31RequestRow = dstDummyActivateGSMSP31Request.DummyActivateGSMSP31Request.NewDummyActivateGSMSP31RequestRow() ' Set the row values rowDummyActivateGSMSP31Request.DummyContext = ActivateGSMRequest.DummyContext rowDummyActivateGSMSP31Request.PhoneNo = ActivateGSMRequest.PhoneNo rowDummyActivateGSMSP31Request.AccountNumber = ActivateGSMRequest.AccountNumber .. .. .. |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

