>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