StackOverflowexception

Discussion in 'ASP .Net' started by =?Utf-8?B?YzY3NjIyOA==?=, Feb 24, 2006.

  1. Hi all,
    I don't know what the exact meaning in my case for this exception to be
    thrown.
    When my program execute the following statement:

    item.NumPersonsOnTrxn = GetNumofPeoplePerTrxn(orderID, sProduct)

    The system.stackoverflowexception was thrown.
    The getNumberofPeoperPerTrxn is just a function defined as follow
    Public Shared Function GetNumofPeoplePerTrxn(ByVal OrderID As String, ByVal
    Product As String) As Integer

    and the item.NumPersonsOnTrxn is an Integer property define in a class
    ProducerTabularReport(Item).
    Can you give me a hint? Before the exception, the function
    GetNumofPeoplePerTrxn(orderID, sProduct) return 2 in watch window,
    item.NumPersonsOnTrxn is 0(byDefault I guess)

    --
    Betty
     
    =?Utf-8?B?YzY3NjIyOA==?=, Feb 24, 2006
    #1
    1. Advertising

  2. ..When this exception is thrown, I only have one pending method call on call
    stack window which is the calling function for GetNumofPeoplePerTrxn.
    --
    Betty


    "c676228" wrote:

    > Hi all,
    > I don't know what the exact meaning in my case for this exception to be
    > thrown.
    > When my program execute the following statement:
    >
    > item.NumPersonsOnTrxn = GetNumofPeoplePerTrxn(orderID, sProduct)
    >
    > The system.stackoverflowexception was thrown.
    > The getNumberofPeoperPerTrxn is just a function defined as follow
    > Public Shared Function GetNumofPeoplePerTrxn(ByVal OrderID As String, ByVal
    > Product As String) As Integer
    >
    > and the item.NumPersonsOnTrxn is an Integer property define in a class
    > ProducerTabularReport(Item).
    > Can you give me a hint? Before the exception, the function
    > GetNumofPeoplePerTrxn(orderID, sProduct) return 2 in watch window,
    > item.NumPersonsOnTrxn is 0(byDefault I guess)
    >
    > --
    > Betty
     
    =?Utf-8?B?YzY3NjIyOA==?=, Feb 24, 2006
    #2
    1. Advertising

  3. Well, the first thing I can tell you is that the problem with the function
    is not in the signature of the function, but in the code of the function.
    That's what you need to post.

    A stack overflow is usually caused by an infinite loop or infinite
    recursion.

    --
    HTH,

    Kevin Spencer
    Microsoft MVP
    ..Net Developer
    A brute awe as you,
    a Metallic hag entity, eat us.


    "c676228" <> wrote in message
    news:...
    > Hi all,
    > I don't know what the exact meaning in my case for this exception to be
    > thrown.
    > When my program execute the following statement:
    >
    > item.NumPersonsOnTrxn = GetNumofPeoplePerTrxn(orderID, sProduct)
    >
    > The system.stackoverflowexception was thrown.
    > The getNumberofPeoperPerTrxn is just a function defined as follow
    > Public Shared Function GetNumofPeoplePerTrxn(ByVal OrderID As String,
    > ByVal
    > Product As String) As Integer
    >
    > and the item.NumPersonsOnTrxn is an Integer property define in a class
    > ProducerTabularReport(Item).
    > Can you give me a hint? Before the exception, the function
    > GetNumofPeoplePerTrxn(orderID, sProduct) return 2 in watch window,
    > item.NumPersonsOnTrxn is 0(byDefault I guess)
    >
    > --
    > Betty
     
    Kevin Spencer, Feb 24, 2006
    #3
  4. Hi Kevin,
    Here is the funciton. I just cannot see there will be an infinite loop here.
    Thanks for your help.

    Public Shared Function GetNumofPeoplePerTrxn(ByVal OrderID As String, ByVal
    Product As String) As Integer
    Dim nameArr(3) As String
    Dim i, j As Integer
    i = 1
    Dim sqlConnection As SqlConnection = New
    SqlConnection(ConfigurationSettings.AppSettings(Global.CfgKeyConnString))
    Dim myCommand As SqlCommand = New
    SqlCommand("getNumPersonPerTrxn", sqlConnection)

    myCommand.CommandType = CommandType.StoredProcedure
    Dim pOrderID As SqlParameter = New SqlParameter("@OrderID",
    SqlDbType.VarChar, 18)
    pOrderID.Value = OrderID
    myCommand.Parameters.Add(pOrderID)

    Dim pProduct As SqlParameter = New SqlParameter("@Product",
    SqlDbType.VarChar, 30)
    pProduct.Value = Product
    myCommand.Parameters.Add(pProduct)

    sqlConnection.Open()
    Dim result As SqlDataReader =
    myCommand.ExecuteReader(CommandBehavior.CloseConnection)
    'expect only one record or none
    If result.Read() Then
    Select Case Product
    Case "Travel Insurance Select"
    If
    CInt(result.GetValue(result.GetOrdinal("SelectPlus"))) = 1 Then
    'code will be add here

    End If
    Case "InterMedical Insurance"
    If
    Trim(CStr(result.GetValue(result.GetOrdinal("SpouseSurname")))) <> "" Then
    i = i + 1
    End If
    For j = 1 To 3
    If
    Trim(CStr(result.GetValue(result.GetOrdinal("Child" & j & "Surname")))) <> ""
    Then
    i = i + 1
    End If
    Next
    End Select
    End If
    Return i
    End Function
    --
    Betty


    "Kevin Spencer" wrote:

    > Well, the first thing I can tell you is that the problem with the function
    > is not in the signature of the function, but in the code of the function.
    > That's what you need to post.
    >
    > A stack overflow is usually caused by an infinite loop or infinite
    > recursion.
    >
    > --
    > HTH,
    >
    > Kevin Spencer
    > Microsoft MVP
    > ..Net Developer
    > A brute awe as you,
    > a Metallic hag entity, eat us.
    >
    >
    > "c676228" <> wrote in message
    > news:...
    > > Hi all,
    > > I don't know what the exact meaning in my case for this exception to be
    > > thrown.
    > > When my program execute the following statement:
    > >
    > > item.NumPersonsOnTrxn = GetNumofPeoplePerTrxn(orderID, sProduct)
    > >
    > > The system.stackoverflowexception was thrown.
    > > The getNumberofPeoperPerTrxn is just a function defined as follow
    > > Public Shared Function GetNumofPeoplePerTrxn(ByVal OrderID As String,
    > > ByVal
    > > Product As String) As Integer
    > >
    > > and the item.NumPersonsOnTrxn is an Integer property define in a class
    > > ProducerTabularReport(Item).
    > > Can you give me a hint? Before the exception, the function
    > > GetNumofPeoplePerTrxn(orderID, sProduct) return 2 in watch window,
    > > item.NumPersonsOnTrxn is 0(byDefault I guess)
    > >
    > > --
    > > Betty

    >
    >
    >
     
    =?Utf-8?B?YzY3NjIyOA==?=, Feb 24, 2006
    #4
  5. Hi all,
    Maybe the problem came from calling function? Here is the code for my
    calling function since the function call GetNumofPeoplePerTrxn(orderID,
    sProduct)
    is inside the for loop.

    Because I after put try...end try block, I got :
    Timeout expired. The timeout period elapsed prior to obtaining a connection
    from the pool. This may have occurred because all pooled connections were in
    use and max pool size was reached.

    But I close the connection in GetNumofPeoplePerTrxn(orderID, sProduct) call.
    SqlHelper is download from report start kits(asp 1.1), I didn't change
    anything.
    It has cn.dispose for each cn.open() I don't know the difference between
    close and dispose.
    /////' the following is my calling function
    Public Shared Function GetProductDetailedReport(ByVal AgentID As String,
    ByVal Product As String, ByVal StartDate As DateTime, ByVal EndDate As
    DateTime) As ProducerTabularReportCollection
    Dim dsData As DataSet =
    SqlHelper.ExecuteDataset(ConfigurationSettings.AppSettings(Global.CfgKeyConnString), "GetProductDetailedReport", AgentID, Product, StartDate, EndDate)
    Dim items As New ProducerTabularReportCollection
    Dim orderID As String
    Dim sProduct As String


    Dim row As DataRow
    For Each row In dsData.Tables(0).Rows
    Dim item As New ProducerTabularReport
    item.AgentID = row("AgentID").ToString()
    item.OrgName = row("Orgname").ToString()
    item.Product = row("Product").ToString()
    item.txnNumber = row("txnNumber").ToString()
    orderID = Trim(row("Order_ID").ToString)
    sProduct = Trim(row("Product").ToString())
    Try
    item.NumPersonsOnTrxn = GetNumofPeoplePerTrxn(orderID,
    sProduct)
    'End Select
    Catch ex As Exception

    Console.WriteLine(ex.Message)


    End Try




    item.TxnDate = Convert.ToDateTime(row("txnDate"))
    item.txnSale = Convert.ToDecimal(row("txnSale"))
    items.Add(item)
    Next
    Return items
    End Function
    --
    Betty


    "c676228" wrote:

    > Hi Kevin,
    > Here is the funciton. I just cannot see there will be an infinite loop here.
    > Thanks for your help.
    >
    > Public Shared Function GetNumofPeoplePerTrxn(ByVal OrderID As String, ByVal
    > Product As String) As Integer
    > Dim nameArr(3) As String
    > Dim i, j As Integer
    > i = 1
    > Dim sqlConnection As SqlConnection = New
    > SqlConnection(ConfigurationSettings.AppSettings(Global.CfgKeyConnString))
    > Dim myCommand As SqlCommand = New
    > SqlCommand("getNumPersonPerTrxn", sqlConnection)
    >
    > myCommand.CommandType = CommandType.StoredProcedure
    > Dim pOrderID As SqlParameter = New SqlParameter("@OrderID",
    > SqlDbType.VarChar, 18)
    > pOrderID.Value = OrderID
    > myCommand.Parameters.Add(pOrderID)
    >
    > Dim pProduct As SqlParameter = New SqlParameter("@Product",
    > SqlDbType.VarChar, 30)
    > pProduct.Value = Product
    > myCommand.Parameters.Add(pProduct)
    >
    > sqlConnection.Open()
    > Dim result As SqlDataReader =
    > myCommand.ExecuteReader(CommandBehavior.CloseConnection)
    > 'expect only one record or none
    > If result.Read() Then
    > Select Case Product
    > Case "Travel Insurance Select"
    > If
    > CInt(result.GetValue(result.GetOrdinal("SelectPlus"))) = 1 Then
    > 'code will be add here
    >
    > End If
    > Case "InterMedical Insurance"
    > If
    > Trim(CStr(result.GetValue(result.GetOrdinal("SpouseSurname")))) <> "" Then
    > i = i + 1
    > End If
    > For j = 1 To 3
    > If
    > Trim(CStr(result.GetValue(result.GetOrdinal("Child" & j & "Surname")))) <> ""
    > Then
    > i = i + 1
    > End If
    > Next
    > End Select
    > End If
    > Return i
    > End Function
    > --
    > Betty
    >
    >
    > "Kevin Spencer" wrote:
    >
    > > Well, the first thing I can tell you is that the problem with the function
    > > is not in the signature of the function, but in the code of the function.
    > > That's what you need to post.
    > >
    > > A stack overflow is usually caused by an infinite loop or infinite
    > > recursion.
    > >
    > > --
    > > HTH,
    > >
    > > Kevin Spencer
    > > Microsoft MVP
    > > ..Net Developer
    > > A brute awe as you,
    > > a Metallic hag entity, eat us.
    > >
    > >
    > > "c676228" <> wrote in message
    > > news:...
    > > > Hi all,
    > > > I don't know what the exact meaning in my case for this exception to be
    > > > thrown.
    > > > When my program execute the following statement:
    > > >
    > > > item.NumPersonsOnTrxn = GetNumofPeoplePerTrxn(orderID, sProduct)
    > > >
    > > > The system.stackoverflowexception was thrown.
    > > > The getNumberofPeoperPerTrxn is just a function defined as follow
    > > > Public Shared Function GetNumofPeoplePerTrxn(ByVal OrderID As String,
    > > > ByVal
    > > > Product As String) As Integer
    > > >
    > > > and the item.NumPersonsOnTrxn is an Integer property define in a class
    > > > ProducerTabularReport(Item).
    > > > Can you give me a hint? Before the exception, the function
    > > > GetNumofPeoplePerTrxn(orderID, sProduct) return 2 in watch window,
    > > > item.NumPersonsOnTrxn is 0(byDefault I guess)
    > > >
    > > > --
    > > > Betty

    > >
    > >
    > >
     
    =?Utf-8?B?YzY3NjIyOA==?=, Feb 24, 2006
    #5
  6. Hi all,
    Now I caught something:

    When I step through I got infinite loop of execution of these two lines

    Set(ByVal Value As Integer)
    NumPersonsOnTrxn = Value
    End Set

    No wonder it throw stackoverflow when it execute: item.NumPersonsOnTrxn =
    GetNumofPeoplePerTrxn(orderID, sProduct).
    But I still don't know how it happens.

    ( I also got infinite lines of the following in call stack window)

    CSRreport.CSRreports.Components.ProducerTabularReport.set_NumPersonsOnTrxn(Integer Value = 1) Line 140 + 0xc bytes Basic

    --
    Betty


    "c676228" wrote:

    > Hi all,
    > Maybe the problem came from calling function? Here is the code for my
    > calling function since the function call GetNumofPeoplePerTrxn(orderID,
    > sProduct)
    > is inside the for loop.
    >
    > Because I after put try...end try block, I got :
    > Timeout expired. The timeout period elapsed prior to obtaining a connection
    > from the pool. This may have occurred because all pooled connections were in
    > use and max pool size was reached.
    >
    > But I close the connection in GetNumofPeoplePerTrxn(orderID, sProduct) call.
    > SqlHelper is download from report start kits(asp 1.1), I didn't change
    > anything.
    > It has cn.dispose for each cn.open() I don't know the difference between
    > close and dispose.
    > /////' the following is my calling function
    > Public Shared Function GetProductDetailedReport(ByVal AgentID As String,
    > ByVal Product As String, ByVal StartDate As DateTime, ByVal EndDate As
    > DateTime) As ProducerTabularReportCollection
    > Dim dsData As DataSet =
    > SqlHelper.ExecuteDataset(ConfigurationSettings.AppSettings(Global.CfgKeyConnString), "GetProductDetailedReport", AgentID, Product, StartDate, EndDate)
    > Dim items As New ProducerTabularReportCollection
    > Dim orderID As String
    > Dim sProduct As String
    >
    >
    > Dim row As DataRow
    > For Each row In dsData.Tables(0).Rows
    > Dim item As New ProducerTabularReport
    > item.AgentID = row("AgentID").ToString()
    > item.OrgName = row("Orgname").ToString()
    > item.Product = row("Product").ToString()
    > item.txnNumber = row("txnNumber").ToString()
    > orderID = Trim(row("Order_ID").ToString)
    > sProduct = Trim(row("Product").ToString())
    > Try
    > item.NumPersonsOnTrxn = GetNumofPeoplePerTrxn(orderID,
    > sProduct)
    > 'End Select
    > Catch ex As Exception
    >
    > Console.WriteLine(ex.Message)
    >
    >
    > End Try
    >
    >
    >
    >
    > item.TxnDate = Convert.ToDateTime(row("txnDate"))
    > item.txnSale = Convert.ToDecimal(row("txnSale"))
    > items.Add(item)
    > Next
    > Return items
    > End Function
    > --
    > Betty
    >
    >
    > "c676228" wrote:
    >
    > > Hi Kevin,
    > > Here is the funciton. I just cannot see there will be an infinite loop here.
    > > Thanks for your help.
    > >
    > > Public Shared Function GetNumofPeoplePerTrxn(ByVal OrderID As String, ByVal
    > > Product As String) As Integer
    > > Dim nameArr(3) As String
    > > Dim i, j As Integer
    > > i = 1
    > > Dim sqlConnection As SqlConnection = New
    > > SqlConnection(ConfigurationSettings.AppSettings(Global.CfgKeyConnString))
    > > Dim myCommand As SqlCommand = New
    > > SqlCommand("getNumPersonPerTrxn", sqlConnection)
    > >
    > > myCommand.CommandType = CommandType.StoredProcedure
    > > Dim pOrderID As SqlParameter = New SqlParameter("@OrderID",
    > > SqlDbType.VarChar, 18)
    > > pOrderID.Value = OrderID
    > > myCommand.Parameters.Add(pOrderID)
    > >
    > > Dim pProduct As SqlParameter = New SqlParameter("@Product",
    > > SqlDbType.VarChar, 30)
    > > pProduct.Value = Product
    > > myCommand.Parameters.Add(pProduct)
    > >
    > > sqlConnection.Open()
    > > Dim result As SqlDataReader =
    > > myCommand.ExecuteReader(CommandBehavior.CloseConnection)
    > > 'expect only one record or none
    > > If result.Read() Then
    > > Select Case Product
    > > Case "Travel Insurance Select"
    > > If
    > > CInt(result.GetValue(result.GetOrdinal("SelectPlus"))) = 1 Then
    > > 'code will be add here
    > >
    > > End If
    > > Case "InterMedical Insurance"
    > > If
    > > Trim(CStr(result.GetValue(result.GetOrdinal("SpouseSurname")))) <> "" Then
    > > i = i + 1
    > > End If
    > > For j = 1 To 3
    > > If
    > > Trim(CStr(result.GetValue(result.GetOrdinal("Child" & j & "Surname")))) <> ""
    > > Then
    > > i = i + 1
    > > End If
    > > Next
    > > End Select
    > > End If
    > > Return i
    > > End Function
    > > --
    > > Betty
    > >
    > >
    > > "Kevin Spencer" wrote:
    > >
    > > > Well, the first thing I can tell you is that the problem with the function
    > > > is not in the signature of the function, but in the code of the function.
    > > > That's what you need to post.
    > > >
    > > > A stack overflow is usually caused by an infinite loop or infinite
    > > > recursion.
    > > >
    > > > --
    > > > HTH,
    > > >
    > > > Kevin Spencer
    > > > Microsoft MVP
    > > > ..Net Developer
    > > > A brute awe as you,
    > > > a Metallic hag entity, eat us.
    > > >
    > > >
    > > > "c676228" <> wrote in message
    > > > news:...
    > > > > Hi all,
    > > > > I don't know what the exact meaning in my case for this exception to be
    > > > > thrown.
    > > > > When my program execute the following statement:
    > > > >
    > > > > item.NumPersonsOnTrxn = GetNumofPeoplePerTrxn(orderID, sProduct)
    > > > >
    > > > > The system.stackoverflowexception was thrown.
    > > > > The getNumberofPeoperPerTrxn is just a function defined as follow
    > > > > Public Shared Function GetNumofPeoplePerTrxn(ByVal OrderID As String,
    > > > > ByVal
    > > > > Product As String) As Integer
    > > > >
    > > > > and the item.NumPersonsOnTrxn is an Integer property define in a class
    > > > > ProducerTabularReport(Item).
    > > > > Can you give me a hint? Before the exception, the function
    > > > > GetNumofPeoplePerTrxn(orderID, sProduct) return 2 in watch window,
    > > > > item.NumPersonsOnTrxn is 0(byDefault I guess)
    > > > >
    > > > > --
    > > > > Betty
    > > >
    > > >
    > > >
     
    =?Utf-8?B?YzY3NjIyOA==?=, Feb 24, 2006
    #6
  7. Ok I caught it. That's because my silly typo cause this nasty problem. I
    guess I shouldn't work on Fri.

    I have a property in the class which looks like this:
    Private _NumPersonsOnTrxn As Integer

    Public Property NumPersonsOnTrxn() As Integer
    Get
    Return _NumPersonsOnTrxn
    End Get
    Set(ByVal Value As Integer)
    NumPersonsOnTrxn = Value 'look at here, I typed
    NumPersonsOnTrxn instead of _NumPersonsOnTrxn and then it cause recursive
    call the Property NumPersonsOnTrxn.
    'what a nasty mistake!

    End Set
    End Property
    --
    Betty


    "c676228" wrote:

    >
    > Hi all,
    > Now I caught something:
    >
    > When I step through I got infinite loop of execution of these two lines
    >
    > Set(ByVal Value As Integer)
    > NumPersonsOnTrxn = Value
    > End Set
    >
    > No wonder it throw stackoverflow when it execute: item.NumPersonsOnTrxn =
    > GetNumofPeoplePerTrxn(orderID, sProduct).
    > But I still don't know how it happens.
    >
    > ( I also got infinite lines of the following in call stack window)
    >
    > CSRreport.CSRreports.Components.ProducerTabularReport.set_NumPersonsOnTrxn(Integer Value = 1) Line 140 + 0xc bytes Basic
    >
    > --
    > Betty
    >
    >
    > "c676228" wrote:
    >
    > > Hi all,
    > > Maybe the problem came from calling function? Here is the code for my
    > > calling function since the function call GetNumofPeoplePerTrxn(orderID,
    > > sProduct)
    > > is inside the for loop.
    > >
    > > Because I after put try...end try block, I got :
    > > Timeout expired. The timeout period elapsed prior to obtaining a connection
    > > from the pool. This may have occurred because all pooled connections were in
    > > use and max pool size was reached.
    > >
    > > But I close the connection in GetNumofPeoplePerTrxn(orderID, sProduct) call.
    > > SqlHelper is download from report start kits(asp 1.1), I didn't change
    > > anything.
    > > It has cn.dispose for each cn.open() I don't know the difference between
    > > close and dispose.
    > > /////' the following is my calling function
    > > Public Shared Function GetProductDetailedReport(ByVal AgentID As String,
    > > ByVal Product As String, ByVal StartDate As DateTime, ByVal EndDate As
    > > DateTime) As ProducerTabularReportCollection
    > > Dim dsData As DataSet =
    > > SqlHelper.ExecuteDataset(ConfigurationSettings.AppSettings(Global.CfgKeyConnString), "GetProductDetailedReport", AgentID, Product, StartDate, EndDate)
    > > Dim items As New ProducerTabularReportCollection
    > > Dim orderID As String
    > > Dim sProduct As String
    > >
    > >
    > > Dim row As DataRow
    > > For Each row In dsData.Tables(0).Rows
    > > Dim item As New ProducerTabularReport
    > > item.AgentID = row("AgentID").ToString()
    > > item.OrgName = row("Orgname").ToString()
    > > item.Product = row("Product").ToString()
    > > item.txnNumber = row("txnNumber").ToString()
    > > orderID = Trim(row("Order_ID").ToString)
    > > sProduct = Trim(row("Product").ToString())
    > > Try
    > > item.NumPersonsOnTrxn = GetNumofPeoplePerTrxn(orderID,
    > > sProduct)
    > > 'End Select
    > > Catch ex As Exception
    > >
    > > Console.WriteLine(ex.Message)
    > >
    > >
    > > End Try
    > >
    > >
    > >
    > >
    > > item.TxnDate = Convert.ToDateTime(row("txnDate"))
    > > item.txnSale = Convert.ToDecimal(row("txnSale"))
    > > items.Add(item)
    > > Next
    > > Return items
    > > End Function
    > > --
    > > Betty
    > >
    > >
    > > "c676228" wrote:
    > >
    > > > Hi Kevin,
    > > > Here is the funciton. I just cannot see there will be an infinite loop here.
    > > > Thanks for your help.
    > > >
    > > > Public Shared Function GetNumofPeoplePerTrxn(ByVal OrderID As String, ByVal
    > > > Product As String) As Integer
    > > > Dim nameArr(3) As String
    > > > Dim i, j As Integer
    > > > i = 1
    > > > Dim sqlConnection As SqlConnection = New
    > > > SqlConnection(ConfigurationSettings.AppSettings(Global.CfgKeyConnString))
    > > > Dim myCommand As SqlCommand = New
    > > > SqlCommand("getNumPersonPerTrxn", sqlConnection)
    > > >
    > > > myCommand.CommandType = CommandType.StoredProcedure
    > > > Dim pOrderID As SqlParameter = New SqlParameter("@OrderID",
    > > > SqlDbType.VarChar, 18)
    > > > pOrderID.Value = OrderID
    > > > myCommand.Parameters.Add(pOrderID)
    > > >
    > > > Dim pProduct As SqlParameter = New SqlParameter("@Product",
    > > > SqlDbType.VarChar, 30)
    > > > pProduct.Value = Product
    > > > myCommand.Parameters.Add(pProduct)
    > > >
    > > > sqlConnection.Open()
    > > > Dim result As SqlDataReader =
    > > > myCommand.ExecuteReader(CommandBehavior.CloseConnection)
    > > > 'expect only one record or none
    > > > If result.Read() Then
    > > > Select Case Product
    > > > Case "Travel Insurance Select"
    > > > If
    > > > CInt(result.GetValue(result.GetOrdinal("SelectPlus"))) = 1 Then
    > > > 'code will be add here
    > > >
    > > > End If
    > > > Case "InterMedical Insurance"
    > > > If
    > > > Trim(CStr(result.GetValue(result.GetOrdinal("SpouseSurname")))) <> "" Then
    > > > i = i + 1
    > > > End If
    > > > For j = 1 To 3
    > > > If
    > > > Trim(CStr(result.GetValue(result.GetOrdinal("Child" & j & "Surname")))) <> ""
    > > > Then
    > > > i = i + 1
    > > > End If
    > > > Next
    > > > End Select
    > > > End If
    > > > Return i
    > > > End Function
    > > > --
    > > > Betty
    > > >
    > > >
    > > > "Kevin Spencer" wrote:
    > > >
    > > > > Well, the first thing I can tell you is that the problem with the function
    > > > > is not in the signature of the function, but in the code of the function.
    > > > > That's what you need to post.
    > > > >
    > > > > A stack overflow is usually caused by an infinite loop or infinite
    > > > > recursion.
    > > > >
    > > > > --
    > > > > HTH,
    > > > >
    > > > > Kevin Spencer
    > > > > Microsoft MVP
    > > > > ..Net Developer
    > > > > A brute awe as you,
    > > > > a Metallic hag entity, eat us.
    > > > >
    > > > >
    > > > > "c676228" <> wrote in message
    > > > > news:...
    > > > > > Hi all,
    > > > > > I don't know what the exact meaning in my case for this exception to be
    > > > > > thrown.
    > > > > > When my program execute the following statement:
    > > > > >
    > > > > > item.NumPersonsOnTrxn = GetNumofPeoplePerTrxn(orderID, sProduct)
    > > > > >
    > > > > > The system.stackoverflowexception was thrown.
    > > > > > The getNumberofPeoperPerTrxn is just a function defined as follow
    > > > > > Public Shared Function GetNumofPeoplePerTrxn(ByVal OrderID As String,
    > > > > > ByVal
    > > > > > Product As String) As Integer
    > > > > >
    > > > > > and the item.NumPersonsOnTrxn is an Integer property define in a class
    > > > > > ProducerTabularReport(Item).
    > > > > > Can you give me a hint? Before the exception, the function
    > > > > > GetNumofPeoplePerTrxn(orderID, sProduct) return 2 in watch window,
    > > > > > item.NumPersonsOnTrxn is 0(byDefault I guess)
    > > > > >
    > > > > > --
    > > > > > Betty
    > > > >
    > > > >
    > > > >
     
    =?Utf-8?B?YzY3NjIyOA==?=, Feb 25, 2006
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?UGF0cmljay5PLklnZQ==?=

    System.StackOverflowException: Exception of type System.StackOverf

    =?Utf-8?B?UGF0cmljay5PLklnZQ==?=, Oct 8, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    3,219
    =?Utf-8?B?UHN5Y2hv?=
    Oct 8, 2004
  2. Lars-Erik Aabech
    Replies:
    8
    Views:
    795
    Steven Cheng[MSFT]
    Apr 29, 2005
  3. =?Utf-8?B?RGFuaWxv?=

    Problem with DllImport StackOverFlowException

    =?Utf-8?B?RGFuaWxv?=, Apr 21, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    623
    Scott Allen
    Apr 22, 2005
  4. Simon Harris

    System.StackOverflowException

    Simon Harris, May 8, 2005, in forum: ASP .Net
    Replies:
    4
    Views:
    4,636
    Web Team @ Borough of Poole
    May 11, 2005
  5. =?Utf-8?B?Qy5EaW1pdHJvdg==?=

    StackOverflowException in .NET Runtimes

    =?Utf-8?B?Qy5EaW1pdHJvdg==?=, Jul 25, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    2,163
    Brock Allen
    Jul 25, 2005
Loading...

Share This Page