Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
What causes conncection handle invalid error
Message
From
01/11/2002 18:23:45
Jason Mesches
Ocean Systems Engineering Corporation
Carlsbad, California, United States
 
 
To
01/11/2002 17:29:15
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00718055
Message ID:
00718065
Views:
17
This message has been marked as the solution to the initial question of the thread.
>Ooops, I think I accidently clicked on the send button before I could finish my thread last time. Here is the complete question:

Yep, and I responded to the wrong one. D'oh!

>HELP!!! Very frequently, as I ran my program (mainly a screen with pageframe, about 5 pages on the page frame), move from 1 record to another, then logout (I did not even do anything else); as I ran the progam the 2nd time, as the form class loads (as it execute: CLOSE DATA ALL), I get "connection handle invalid" error. Once that happens, I basically need to force VFP to quit (end task) & restart VFP. Typing CLOSE DATA ALL on the command window will give me the same error. Can anybody give me a hint on what to check?
>
>
>myForm.Load():
>
>CLOSE DATA ALL
>lcConnStrAUSD="DRIVER={Microsoft Visual FoxPro Driver};" + ;
>"SourceDB=C:\Projects\mydata.dbc;SourceType=DBC;UID=;PWD=;"
>
>THIS.lnHandle=SQLSTRINGCONNECT(lcConnStrAUSD)
>
>IF THIS.lnHandleERCA>0
> lSuccess=SQLEXEC(THIS.lnHandleERCA,"SELECT * FROM myData","cMyData")
> IF lSuccess=1
> SET MULTILOCKS ON
> CURSORSETPROP('Buffering',3,'cMyData')
> CURSORSETPROP('TABLES','erca','cERCA')
> CURSORSETPROP('UPDATABLEFIELDLIST','myField','cMyData')
> CURSORSETPROP('KeyFieldList','myField','cMyData')
> CURSORSETPROP('UpdateNameList','myField,'cMyData')
> CURSORSETPROP('FetchMemo',.T.,'cMyData')
> CURSORSETPROP('SendUpdates',.T.,'cERCA')
> ENDIF
>ENDIF
>
>
>myForm.Unload()
>*(as user clicks LogOut)
>lSuccess=SQLDISCONNECT(THIS.lnHandle)
You get this error when you try to do something with a connection without the connection existing.

Typically, this happens with SQLEXEC(), SQLGETPROP(), or SQLDISCONNECT(), but I suspect something like this is happening:

There is an uncommitted change in a buffer from one of the views in this form. When that form unloads you SQLDISCONNECT() that view from its database. Then when it re-opens, it tries to CLOSE DATA. This causes the view to attempt to send back its uncommitted changes, but it can't find its little breadcrumb trail back to the dbc anymore. Now, all it can do is send an error. I bet that if you pull up your datasession, find the view, and issue a TABLEREVERT() on it, you can then CLOSE DATA ALL.

Hope that makes sense,
---J
Previous
Reply
Map
View

Click here to load this message in the networking platform