Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

what cause stack overflow in SQLSERVER CE Update?

Posted on 2010-08-23
5
Medium Priority
?
512 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:
Meir Rivkin earned 1000 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:Meir Rivkin
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 1000 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
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.
Suggested Courses

650 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