OleDB close problem

dwneder

New member
Joined
Jul 15, 2013
Messages
2
Programming Experience
10+
This is really frustrating me!

I have an issue where closing an OleDB connection (to an Access 2010 database) terminates processing (of the remainder of the routine) without throwing any error. This seems to happen in more than one place and didn't happen before moving to a newer server (IIS 7.0, .Net 4.0).

I'd appreciate any thoughts on this. Here's the code that causes the problem:
' sConnectionString is set properly as everything else executes correctly
' connection string = Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\bam.accdb;Persist Security Info=False;

                    Dim conn As OleDbConnection = New OleDbConnection(sConnectionString)
                    Dim cmd As OleDbCommand = New OleDbCommand()
                    Dim sdr As OleDbDataReader
                    Dim sql As String = "SELECT [order_user_id], [order_pay_status] FROM [Orders] WHERE [order_id] = " & sOrderID


                        Try


                            conn.Open()
                            cmd = New OleDbCommand(sql, conn)
                            errRoutineName = "OrderIPN:ReadOrderPayStatus"


                            sdr = cmd.ExecuteReader(Data.CommandBehavior.SingleRow)
                            Dim bFound As Boolean = sdr.Read()


                            If bFound Then
                                sUsrID = sdr("order_user_id") & ""
                                iPay = DBNullToInteger(sdr("order_pay_status"))
                            End If


                            sdr.Close()

' *** THIS line causes the problem - everything else works correctly and even retrieves "order_user_id" and "order_pay_status" from the database.


                            conn.Close()

' *** We never get here!


                        Catch ex As Exception


                            HandleDBError()
                            Exit Sub


                        End Try
                    End If


' *** We never get here either!

... continuation of routine below ...
 
Last edited by a moderator:
Without throwing any error? I very much doubt that. You've got an exception handler there but, as far as I can tell, you're not taking note of the actual exception. If you put a breakpoint on that HandleDBError call, does it get hit? If so then what type of exception is 'ex' and what is it's Message property value?
 
Without throwing any error? I very much doubt that. You've got an exception handler there but, as far as I can tell, you're not taking note of the actual exception. If you put a breakpoint on that HandleDBError call, does it get hit? If so then what type of exception is 'ex' and what is it's Message property value?


Hello and thanks for your response!

Note that the code is wrapped in a Try/Catch statement?

For brevity, I simplified the Catch portion to HandleDBError() but in fact, I have a very sophisticated error management system that includes logging to a database and emailing me extensive details. Further, this error system has been in use for a number of years and continues to catch other system errors.

When this script dies it never hits my error handler - in fact, it is never throwing any errors whatsoever or I'd have log entries to that effect. None exist.

Also, this happens to be "formless" code; meaning that while there's <html></html><body></body> code on the form, it's not used. This script is called directly from PayPal in processing payments and never presents any user-interface elements.

Since this is SAAS it can't be debugged in the same way, but even then, on my own development machine, I don't have any problem with that piece of code.

Any other thoughts?
 
Back
Top