-----------------------------------------------------------
New Message on BDOTNET
-----------------------------------------------------------
From: rashub21
Message 1 in Discussion
Gurus, I need to fix this today. It has become very urgent. Please refer my
mail pasted below:
Gurus,<o:p></o:p>
I need some urgent help with this.<o:p></o:p>
I had a deadlock problem reported by some Users. The error log pointed to this
piece of function (please refer the code below).
The deadlock was not reproducable on my standalone system however teh code
modified it to intriduce a transaction object.<o:p></o:p>
Now, if I execute single instance of the application on my system, there is no
problem (there was none earlier when running single instance).
However, if I execute 2 instances of the application and carry out operation
to invoke this function, I get the below error message.
(The function code and the rror message are listed below)<o:p></o:p>
<o:p></o:p>
Please HELP!!!<o:p></o:p>
Function Code
Public Function GetEntityParentList(ByVal EntityType As Entity.Types, Optional
ByVal GeographyIDList As UnsortedList = Nothing, Optional ByVal
LineOfBusinessIDList As UnsortedList = Nothing, Optional ByVal CategoryIDList
As UnsortedList = Nothing, Optional ByVal StartDate As DateTime = #12:00:00
AM#, Optional ByVal EndDate As DateTime = #12:00:00 AM#) As
UnsortedList<o:p></o:p>
' Trace Message
Tracer.LogMessage(MethodInfo.GetCurrentMethod().DeclaringType.Name +
"." + MethodInfo.GetCurrentMethod().Name + "()", Tracer.TraceTypes.In)
' --------------<o:p></o:p>
Dim list As UnsortedList = New UnsortedList<o:p></o:p>
' Initialise parameter array
Dim parameters() As SqlParameter = New SqlParameter(7) {}<o:p></o:p>
parameters(0) = New SqlParameter("@EntityType", SqlDbType.TinyInt)
If EntityType > 0 Then
parameters(0).Value = EntityType
Else
parameters(0).Value = DBNull.Value
End If
parameters(1) = New SqlParameter("@GeographyIDList", SqlDbType.VarChar,
8000)
If Not GeographyIDList Is Nothing Then
parameters(1).Value = GetIDsFromList(GeographyIDList)
Else
parameters(1).Value = DBNull.Value
End If
parameters(2) = New SqlParameter("@CategoryIDList", SqlDbType.VarChar,
8000)
If Not CategoryIDList Is Nothing Then
parameters(2).Value = GetIDsFromList(CategoryIDList)
Else
parameters(2).Value = DBNull.Value
End If
parameters(3) = New SqlParameter("@LineOfBusinessIDList",
SqlDbType.VarChar, 8000)
If Not LineOfBusinessIDList Is Nothing Then
parameters(3).Value = GetIDsFromList(LineOfBusinessIDList)
Else
parameters(3).Value = DBNull.Value
End If
parameters(4) = New SqlParameter("@StartDate", SqlDbType.DateTime)
If StartDate > #12:00:00 AM# Then
parameters(4).Value = StartDate
Else
parameters(4).Value = DBNull.Value
End If
parameters(5) = New SqlParameter("@EndDate", SqlDbType.DateTime)
If EndDate > #12:00:00 AM# Then
parameters(5).Value = EndDate
Else
parameters(5).Value = DBNull.Value
End If
parameters(6) = New SqlParameter
parameters(6).Direction = ParameterDirection.ReturnValue<o:p></o:p>
Dim reader As SqlDataReader
Dim MyTransaction As SqlTransaction = Nothing
Dim MyConnection As SqlConnection<o:p></o:p>
MyConnection = New
SqlConnection(ConfigurationSettings.AppSettings("DatabaseConnection"))
MyConnection.Open()
MyTransaction = MyConnection.BeginTransaction()<o:p></o:p>
Try
reader = SqlHelper.ExecuteReader(MyTransaction,
CommandType.StoredProcedure, "GetEntityParentList", parameters)<o:p></o:p>
Dim idOrdinal As Integer = reader.GetOrdinal("ID")
Dim nameOrdinal As Integer = reader.GetOrdinal("Name")
Dim myCode As Code
' For each result populate it and add it to the return list
While (reader.Read())
myCode = New Code(reader, idOrdinal, nameOrdinal)
list.Add(myCode.ID, myCode)
End While<o:p></o:p>
If Not reader Is Nothing Then
If Not reader.IsClosed Then
reader.Close()
End If
End If
If Not MyTransaction Is Nothing Then
MyTransaction.Commit()
End If
Catch e As Exception
If Not MyTransaction Is Nothing Then
MyTransaction.Rollback()
End If
Throw New ApplicationException("Save Failed in Entity Manager",
e)<o:p></o:p>
Finally
If Not reader Is Nothing Then
If Not reader.IsClosed Then
reader.Close()
End If
End If<o:p></o:p>
If Not MyTransaction Is Nothing Then
MyTransaction.Dispose()
End If
If Not MyConnection Is Nothing Then
MyConnection.Dispose()
End If
End Try<o:p></o:p>
' --------------
' Trace Message
Tracer.LogMessage(MethodInfo.GetCurrentMethod().DeclaringType.Name +
"." + MethodInfo.GetCurrentMethod().Name + "()",
Tracer.TraceTypes.Out)<o:p></o:p>
Return list<o:p></o:p>
End Function<o:p></o:p>
Error Message
Error message:
Exception of type System.Web.HttpUnhandledException was thrown.
Stack Trace:
at System.Web.UI.Page.HandleError(Exception e) at
System.Web.UI.Page.ProcessRequestMain() at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequest(HttpContext context) at
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication+IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&
completedSynchronously)
Source:
System.Web<o:p></o:p>
Inner Exception:
Error message:
The SqlCommand is currently busy Open, Fetching.
Stack Trace:
at System.Data.SqlClient.SqlCommand.set_Transaction(SqlTransaction value) at
System.Data.SqlClient.SqlTransaction.GetServerTransactionLevel() at
System.Data.SqlClient.SqlTransaction.CheckTransactionLevelAndZombie() at
System.Data.SqlClient.SqlTransaction.Rollback() at
Shell.ValueImprovement.BusinessObjects.EntityManager.GetEntityParentList(Types
EntityType, UnsortedList GeographyIDList, UnsortedList LineOfBusinessIDList,
UnsortedList CategoryIDList, DateTime StartDate, DateTime EndDate) in
C:\Apps\eVita\BusinessObjects\EntityManager\EntityManager.vb:line 5024 at
Shell.ValueImprovement.Controllers.EntityController.GetEntityParentList(Types
EntityType, UnsortedList GeographyIDList, UnsortedList LineOfBusinessIDList,
UnsortedList CategoryIDList, DateTime StartDate, DateTime EndDate) in
C:\Apps\eVita\Controllers\EntityController.vb:line 953 at
Shell.ValueImprovement.WebUI.FinancialControls.LoadAvailableContributions(Attribution&
TheDaddy, Attribution& MyAttribution, Entity& MyEntity, EntityController&
MyController, UnsortedList AllSpendCategoryList, UnsortedList allGeogList,
UnsortedList allLobList) in C:\Inetpub\wwwroot\eVita\FinancialControls.vb:line
1503 at Shell.ValueImprovement.WebUI.ProjectDetail.PopulateScreen(Project
myProject, ArrayList userRoles) in
C:\Inetpub\wwwroot\eVita\ProjectDetail.aspx.vb:line 1362 at
Shell.ValueImprovement.WebUI.ProjectDetail.SaveBtn_Click(Object sender,
ImageClickEventArgs e) in C:\Inetpub\wwwroot\eVita\ProjectDetail.aspx.vb:line
790 at System.Web.UI.WebControls.ImageButton.OnClick(ImageClickEventArgs e) at
System.Web.UI.WebControls.ImageButton.System.Web.UI.IPostBackEventHandlerRaisePostBackEvent(String
eventArgument) at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument) at
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) at
System.Web.UI.Page.ProcessRequestMain()
Source:
System.Data<o:p></o:p>
<o:p></o:p>
-----------------------------------------------------------
To stop getting this e-mail, or change how often it arrives, go to your E-mail
Settings.
http://groups.msn.com/bdotnet/_emailsettings.msnw
Need help? If you've forgotten your password, please go to Passport Member
Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help
For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact
If you do not want to receive future e-mail from this MSN group, or if you
received this message by mistake, please click the "Remove" link below. On the
pre-addressed e-mail message that opens, simply click "Send". Your e-mail
address will be deleted from this group's mailing list.
mailto:[EMAIL PROTECTED]