UtterAccess.com
We have detected that you are using an unsupported web browser. We recommend you to upgrade your web browser to get the most from UtterAccess forums.
Why should and how can I upgrade?
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Runtime Error 3704 - ODBC DSN-less connection via ADO    
 
   
papag00se
post Apr 27 2009, 11:32 AM
Post #1

New Member
Posts: 2



All-
The attached routine is attempting to query some sample tables from both Oracle and Sybase databases in an effort to determine if the data servers are alive and well. It is invoked from an MS Access (2003) module and is attempting to make a DSN less connection. The code operates flawlessly when it is stepped through in the debugger, however, when the routine is invoked at runtime, the error 3704 - "Operation is not allowed when the object is closed." is thrown.

Any assistance would be greatly appreciated.
Phil
Attached File(s)
Attached File  CodeSample.zip ( 1.32K ) Number of downloads: 5
 
Go to the top of the page
 
+
LPurvis
post Apr 27 2009, 01:32 PM
Post #2

UtterAccess Editor
Posts: 14,795
From: England (North East / South Yorks)



Hi - welcome to Utter Access!
Generally it's better - and quicker for us - if you just post your code directly in the thread, I don't know about anyone else, but I nearly didn't look, just about to leave as need to get on with things :-)
Not connecting to the sources you list I can't say for certain.
However it looks like you open full recordsets just to check for the existence of any records (i.e. RecordCount > 0)
If that's the case then returning a single row (TOP 1) or taking a count (SELECT COUNT(*) FROM TableName) instead of returning every field and every row - well, index row given the type of recordsets you're likely getting back. (I say likely again because I can't be sure how the providers for the RDBMS you use provide cursor types).
The difference of your problem being exeuction speed (stepping through as opposed to direct runthrough) it seems to me the culprit here is your recordset opening.
(You've implemented On Error Resume Next by this stage - so without that you might have more to go on).
But I'd recommend changing to
sSQL = sSQL & "SELECT COUNT(*) FROM " & .Fields(sSAMPLE_TABLE)

rst.Open sSQL, cn, adOpenKeyset, adLockReadOnly
lngRecordCount = rst(0)
HAs executing the recordset asyncronously is probably not necessary - but potentially causing your problems.
(The rest of it is just suggestion for efficiency.)
Cheers.
Go to the top of the page
 
+
papag00se
post Apr 27 2009, 04:03 PM
Post #3

New Member
Posts: 2



Leigh-
Thanks for the reply. Removing the ExecuteOptionEnum, 'adAsyncExecute' solved the problem.
Appreciato...
Phil
Go to the top of the page
 
+
LPurvis
post Apr 27 2009, 04:16 PM
Post #4

UtterAccess Editor
Posts: 14,795
From: England (North East / South Yorks)



Glad to hear it. You're welcome. thumbup.gif
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Search  ·  Go to Top  ·  Lo-Fi Version Time is now: 24th November 2014 - 04:09 AM