Solved

what cause stack overflow in SQLSERVER CE Update?

Posted on 2010-08-23
5
509 Views
Last Modified: 2012-06-27
Assuming I do not have recursion or an infinite loop (I have checked), what should I be looking for as a possible cause of a stackoverflow exception in this line of the attached code..

SQLCeAdapter.UpdateCommand.ExecuteNonQuery()

Open in new window


Public Function UpdateSQLwithVars(ByVal strsql As String, ByVal vars As ArrayList, ByRef lex As LastException) As Boolean


        Dim SQLCeAdapter As System.Data.SqlServerCe.SqlCeDataAdapter = Nothing
        Dim sparm As SqlServerCe.SqlCeParameter
        Dim retval As Boolean = True
        Dim sqlcomm As New SqlServerCe.SqlCeCommand
        sqlcomm.Connection = _conobj
        sqlcomm.CommandText = strsql

        Try
            SQLCeAdapter = New System.Data.SqlServerCe.SqlCeDataAdapter(strsql, _conobj)
            SQLCeAdapter.UpdateCommand = sqlcomm
            For Each sparm In vars
                SQLCeAdapter.UpdateCommand.Parameters.Add(sparm)
            Next
            SQLCeAdapter.UpdateCommand.ExecuteNonQuery()

        Catch ex As Exception
            retval = False
            lex.ErrorMessage = ex.Message
            If Not ex.InnerException Is Nothing Then
                lex.ErrorMessage = lex.ErrorMessage & vbCrLf & ex.InnerException.Message
            End If

        Finally
            If Not SQLCeAdapter Is Nothing Then
                SQLCeAdapter.Dispose()
            End If

        End Try

        Return retval

    End Function

Open in new window

0
Comment
Question by:codefinger
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 42

Accepted Solution

by:
sedgwick earned 250 total points
ID: 33498932
does the strsql is a simple query? does it call a stored procedure which might cause this?
0
 
LVL 42

Expert Comment

by:sedgwick
ID: 33498938
what vars As ArrayList looks like?
0
 

Author Comment

by:codefinger
ID: 33500360
"UPDATE CommandCodes SET VerbalCommand = @xVerbalCommand Where CommandNo = @xCommandNo"

sqlvars(1) = New System.Data.SqlServerCe.SqlCeParameter
sqlvars(1).ParameterName = "@xVerbalCommand"
sqlvars(1).SqlDbType = System.Data.SqlDbType.NVarChar
 sqlvars(1).Value = vc.VerbalCommand    (= "Start your engine.")


sqlvars(10) = New System.Data.SqlServerCe.SqlCeParameter
sqlvars(10).ParameterName = "@xCommandNo"
sqlvars(10).SqlDbType = System.Data.SqlDbType.Int
sqlvars(10).Value = vc.CommandNo    (= 5)

vars = New ArrayList
vars.Add(sqlvars(1))
vars.Add(sqlvars(10))

CommandCodes Table:
-------------------------------------
CommandNo Int(4)
VerbalCommand nvarchar(300)


0
 
LVL 28

Assisted Solution

by:Ark
Ark earned 250 total points
ID: 33508133
Stack overflow means endless circular execution. Do you have OnUpdate triggers?
0
 

Author Closing Comment

by:codefinger
ID: 33558775
It was not really the answer, but with what I gave you to work with, it was a good attempt.  ( I stated that I had checked for a circular execution in the code, but I did not check closely enough!)
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question