Solved

what cause stack overflow in SQLSERVER CE Update?

Posted on 2010-08-23
5
498 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
  • 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 27

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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

When you hear the word proxy, you may become apprehensive. This article will help you to understand Proxy and when it is useful. Let's talk Proxy for SQL Server. (Not in terms of Internet access.) Typically, you'll run into this type of problem w…
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Via a live example, show how to shrink a transaction log file down to a reasonable size.

743 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now