the error msg:
Code:
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: Connection must be valid and open to commit transaction
Source Error:
Line 60: Return projectsId
Line 61: Finally
Line 62: myTransactionScope.Dispose()
Line 63: 'CType(myTransactionScope, IDisposable).Dispose()
Line 64: End Try
Source File: c:\inetpub\wwwroot\keithdesign2\App_Code\global\BLL\ProjectsManager.vb Line: 62
Stack Trace:
[InvalidOperationException: Connection must be valid and open to commit transaction]
MySql.Data.MySqlClient.MySqlTransaction.Commit() +119
MySql.Data.MySqlClient.MySqlPromotableTransaction.System.Transactions.IPromotableSinglePhaseNotification.SinglePhaseCommit(SinglePhaseEnlistment singlePhaseEnlistment) +13
System.Transactions.DurableEnlistmentCommitting.EnterState(InternalEnlistment enlistment) +257
System.Transactions.DurableEnlistmentActive.ChangeStateCommitting(InternalEnlistment enlistment) +16
System.Transactions.TransactionStateSPC.EnterState(InternalTransaction tx) +31
System.Transactions.TransactionStateVolatilePhase1.EnterState(InternalTransaction tx) +277
System.Transactions.TransactionStatePhase0.EnterState(InternalTransaction tx) +138
System.Transactions.TransactionStateActive.BeginCommit(InternalTransaction tx, Boolean asyncCommit, AsyncCallback asyncCallback, Object asyncState) +47
System.Transactions.CommittableTransaction.Commit() +210
System.Transactions.TransactionScope.InternalDispose() +411
System.Transactions.TransactionScope.Dispose() +2053
Keith.ProjectsManager.Bll.ProjectsManager.Update(Projects myProjects) in c:\inetpub\wwwroot\keithdesign2\App_Code\global\BLL\ProjectsManager.vb:62
[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) +0
System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) +72
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) +371
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +29
System.Web.UI.WebControls.ObjectDataSourceView.InvokeMethod(ObjectDataSourceMethod method, Boolean disposeInstance, Object& instance) +480
System.Web.UI.WebControls.ObjectDataSourceView.InvokeMethod(ObjectDataSourceMethod method) +38
System.Web.UI.WebControls.ObjectDataSourceView.ExecuteUpdate(IDictionary keys, IDictionary values, IDictionary oldValues) +2539
System.Web.UI.DataSourceView.Update(IDictionary keys, IDictionary values, IDictionary oldValues, DataSourceViewOperationCallback callback) +78
System.Web.UI.WebControls.GridView.HandleUpdate(GridViewRow row, Int32 rowIndex, Boolean causesValidation) +1215
System.Web.UI.WebControls.GridView.HandleEvent(EventArgs e, Boolean causesValidation, String validationGroup) +837
System.Web.UI.WebControls.GridView.OnBubbleEvent(Object source, EventArgs e) +95
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35
System.Web.UI.WebControls.GridViewRow.OnBubbleEvent(Object source, EventArgs e) +117
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35
System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e) +115
System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument) +132
System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +177
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1746
the relevant code: DAL
Code:
Public Shared Function Update(ByVal myProjects As Projects) As Integer
Dim result As Integer = 0
' Using
Dim myConnection As MySqlConnection = New MySqlConnection(myConfig.myConnection)
Try
Dim myCommand As MySqlCommand = New MySqlCommand("sprocProjectsUpdateSingleItem", myConnection)
myCommand.CommandType = CommandType.StoredProcedure
'myCommand.Parameters.AddWithValue("?id", myProjects.Id)
myCommand.Parameters.AddWithValue("?UserId", myProjects.UserId)
myCommand.Parameters.AddWithValue("?TheDate", myProjects.TheDate)
myCommand.Parameters.AddWithValue("?Name", myProjects.Name)
myCommand.Parameters.AddWithValue("?Number", myProjects.Number)
myCommand.Parameters.AddWithValue("?Description", myProjects.Description)
'Dim returnValue As MySqlParameter
'returnValue = myCommand.CreateParameter
'returnValue.Direction = ParameterDirection.ReturnValue
'myCommand.Parameters.Add(New MySqlParameter("?returnValue", returnValue))
myConnection.Open()
myCommand.ExecuteNonQuery()
'result = Convert.ToInt32(returnValue.Value)
myConnection.Close()
Finally
CType(myConnection, IDisposable).Dispose()
End Try
Return result
End Function
the relevant code: BLL
Code:
<DataObjectMethod(DataObjectMethodType.Update, True)> _
Public Shared Function Update(ByVal myProjects As Projects) As Integer
' Using
Dim myTransactionScope As TransactionScope = New TransactionScope
Try
Dim projectsId As Integer = ProjectsDB.Update(myProjects)
'For Each myZones As Zones In myProjects.Zones
'myZones.ProjectId = projectsId
'ZonesDB.Update(myZones)
'Next
myProjects.Id = projectsId
myTransactionScope.Complete()
Return projectsId
Finally
CType(myTransactionScope, IDisposable).Dispose()
End Try
End Function
any ideas guys

Shem