OLEDB Connection open and close issue

icheong

New member
Joined
Apr 28, 2008
Messages
1
Programming Experience
1-3
Hi,
I've got an OleDbConnection instantiated by this:
VB.NET:
Dim WithEvents ConnectionDBOLEDB As New OleDbConnection("File Name=" & varUDLPath)

I have opened the connection with:
VB.NET:
ConnectionDBOLEDB.Open()

Now, I make a query with OleDbCommand and try to read the results with OleDbDataReader.

When the command takes too long and exceeds the timeout limit, my function thows and exception and when caught, I print out the exception error message and it says "Timeout exceeded".

When this happens, I need to close my ConnectionDBOLEDB database connection so I try
VB.NET:
ConnectionDBOLEDB.Close()
and this is where the problem is. It stalls at this very line until something else happens ie. i quit the program or the network connection is lost physically (which is an event that I capture to perform other functions)

I'm wondering how do I forcefully disconnect this database connection so that the program can continue it's duties?

Thanks.
 
sounds like youre getting an exception, but the query is still running; i wouldnt count on the timeout canceling the query, merely notifying you tha tthe query has run too long. As such, calling close on the connection might block until the query has finished. See if ther eis a way of canceling the query or make it quicker
 
Back
Top