Quantcast
Channel: MySQL Forums - Connector/NET and C#, Mono, .Net
Viewing all articles
Browse latest Browse all 1451

EndExecuteNonQuery ownership problem in callback (1 reply)

$
0
0
Hi All,

I am in the process of developing an application (VB.NET) to execute MySQL stored procedures asynchronously. Essentially this is to act as a process manager so that users can submit a request, not have to wait around for it to be processed, and still have the results (or errors) from the request stored for later review.

Everything about the application is working, except for the callback from BeginExecuteNonQuery. The callback procedure attempts to call EndExecuteNonQuery but fails with 'error 1095: You are not the owner of thread xx'.

I am using VB.NET on Windows XP for the client application. The server is MySQL 5.1.49-community also on XP. I am using Connector/.NET 6.2.3.

Part of the code (much simplified):


Public Sub StartNonQuery()

        'set the connection
        FBCommand.Connection = cnn

        'run the command
        Try
	    FBCommand.CommandText = Me.SQLString
            tmpvr = FBCommand.BeginExecuteNonQuery(AddressOf DoneQuerying, FBCommand)
        Catch mse As MySqlException
            MsgBox("Mysql Exception " & mse.Message & " in function StartNonQuery")
            
        Catch ex As Exception
            MsgBox("General Exception " & ex.Message & " in function StartNonQuery")
            
        End Try

End Sub

Public Sub DoneQuerying(ByVal ias As IAsyncResult)

        Dim rowcnt As Long

        Try
            'terminate query
            Dim thiscommand As MySqlCommand = CType(ias.AsyncState, MySqlCommand)
            rowcnt = thiscommand.EndExecuteNonQuery(ias)
            
	    MsgBox(rowcnt & " rows affected")
    
            
        Catch mse As MySqlException
            MsgBox("Mysql Exception " & mse.Message & " in function DoneQuerying")

            
        Catch ex As Exception
            MsgBox("General Exception " & ex.Message & " in function DoneQuerying")
            
        End Try

End Sub

Despite having exception handlers at every turn, the exception is not trapped but is reported directly by VB in the immediate window. I have tried searching these forums and google for others experiencing the same problem but have drawn a blank, so any thoughts would be much appreciated. Many thanks!

Viewing all articles
Browse latest Browse all 1451

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>