Chuck,
Here's the scoop...
When a view closes, VFP automatically closes its connection when there are no views left using that connection. In other words, the last one out closes the "door."
In Mere Mortals, cConnectionManager (in cManager.vcx) keeps track of all connections and how many views/cursors are using it. By default, when your data environment closes a view, it will notify the connection manager, which, in turn, calls SQLDisconnect() if there are no more views "interested" in the connection.
This can get out of sync if you have code somewhere that closes your view (USE IN "MyView", CLOSE DATA) without also notifying the connection manager.
You'll see the results in one of two ways.
The first is what you're describing. The connection manager tries to issue a SQLDisconnect() on a connection that's non-existent, and voila... mayhem.
The other is the next time a view is to be opened, the connection manager starts looping through its collection of "good" connections looking to reuse one if possible. When it runs a SQLGetProp() against a connection that no longer exists, "Connection handle is invalid" is your reward.
If none of this rings a bell, and you're not sure which view is causing your error, let me know and we can go from there.
Lengthy, I know... but hopefully it'll help,
---J
>Hi All,
>
>I have been having problems with my forms taking forever to release (intermittantly) and have found that I am getting error 1466 in the IsSQLConnectionValid method of cconnectionmgr. I also get the error in the cdynamicviewcursor.close method when it trys to disconnect the connection handle. My question is, what should I look for? What would cause a connection handle to become invalid? It must be getting released somewhere, but how do I troubleshoot that?
>
>Any direction pointing would be greatly appreciated!
>
>Thanks,
>
>Chuck