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
Solved

what cause stack overflow in SQLSERVER CE Update?

Posted on 2010-08-23
5
508 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 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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
I have a large data set and a SSIS package. How can I load this file in multi threading?
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Via a live example, show how to shrink a transaction log file down to a reasonable size.

808 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