stack overflow

Last Reply on Dec 19, 2011 01:45 AM By Mudassar

Posted on Dec 19, 2011 01:43 AM

hii.. m getting this error..

An unhandled exception of type 'System.StackOverflowException' occurred in mscorlib.dll

Sub randgen()
        Randomize()
        rndum = ""
        Dim i As Integer = 0
        For i = 1 To 8
            x = Int(Rnd() * 10)
            rndum = rndum & x
        Next
        nameAbbrevation()
        If nameFlag = 1 Then
            If ddlLoanScheme.SelectedValue = "Marraige Loan" Then
                ackid = "MarLn_" & newword & rndum

            ElseIf ddlLoanScheme.SelectedValue = "Medical Facility" Then
                ackid = "MediFac_" & newword & rndum

            ElseIf ddlLoanScheme.SelectedValue = "Business Loan" Then
                ackid = "BusiLn_" & newword & rndum

            ElseIf ddlLoanScheme.SelectedValue = "Education Loan" Then
                ackid = "EduLn_" & newword & rndum

            ElseIf ddlLoanScheme.SelectedValue = "Home Loan" Then
                ackid = "HomeLn_" & newword & rndum

            ElseIf ddlLoanScheme.SelectedValue = "Auto Loan" Then
                ackid = "AutoLn_" & newword & rndum

            ElseIf ddlLoanScheme.SelectedValue = "Personal Loan" Then
                ackid = "PerLn_" & newword & rndum

            End If

            Dim cnt1 As Integer = 0

            con.Open()
            cmd = New SqlCommand("Proc_AddAppDetails", con)
            cmd.CommandType = Data.CommandType.StoredProcedure
            cmd.Parameters.Add(New SqlParameter("@Mode", Data.SqlDbType.VarChar, 50))
            cmd.Parameters.AddWithValue("@strAppNo", Replace(Replace(ackid, "'", "''"), "<", ""))
            cmd.Parameters("@Mode").Value = "chkDupAckwid"
            cnt1 = cmd.ExecuteScalar()
            con.Close()

            If cnt1 = 0 Then
                ackid = ackid
            ElseIf cnt1 > 0 Then
                ackid = ""
            End If
        End If

        If ackid = "" Then
            randgen()
        End If

    End Sub

 

 

m getting error at con.Open()

pls help

Posted on Dec 19, 2011 01:45 AM

Could you please point out the line which is causing error. Or copy and paste the whole stack trace that you are getting

as done here http://www.aspforums.net/Threads/572540/Extracting-gridview-to-pdf-file/?p=1#Replies