Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Testing ADODB connection
Message
From
13/07/2001 12:45:58
 
 
To
13/07/2001 11:58:24
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Miscellaneous
Thread ID:
00530321
Message ID:
00530362
Views:
19
>Does anyone know how to test the actual ADODB connection to determine if it is open or not? In the application I am using, I can't simply test to see if an ADODB object has been instantiated. I need to test the connection itself.
>
>Thanks in advance

You can SELECT anything to determine if your connection is up and working. This also answers you question about how to prevent error messages from occuring if your connection has gone bad.
function isConnectionOpen
lparameters oConnection
	local lcOldError, err, ors, llReturnValue
	lcOldError = on("error")
	err = .f.
	on error err = .t.
	ors = oconnection.execute("Select 'GoodConnection' as 'success'") && thanks to Mike Levy, I think...
 	on error &lcOldError
	if err
		llReturnValue = .f.
	else
		llReturnValue = !(ors.eof())
	endif
	if llReturnValue
		ors.close()
		release ors
	endif
	return llReturnValue
endproc
HTH,
Steve Gibson
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform