Hi Peter,
Can you repro the issue without the Form? I mean simply by executing the code the form would execute. Could you post that code? Does the form calls REQUERY()? Does any of those calls fail (check return value)?
Thanks,
Aleksey.
>Justin,
>
>VFP 8.0 SP1, W2K, latest SP, SQL Server 2000 latest SP.
>
>I've narrowed it down a bit, and it seems it always crashes after a certain sequence of events.
>
>I initially use a public variable lnSql to connect to DB1.
>
>A menu allows the user to switch to alternate DB's, i.e. DB2, DB3 a.s.o.
>
>
>* In Main.prg
>PUBLIC lnSql AS Integer
>lnResult = SQLCONNECT('DB1',.T.)
>IF lnResult < 1
> * Write message to errolog and quit
>ENDIF
>
>oMainForm = CREATEOBJECT('MainMenuForm')
>oMainForm.Show()
>READ EVENTS
>
>
>
>
>
>* In MainForm's menu, BAR 'Choose Client' PROMPT DB1..DBn
>* The code in all these menu options goes like this:
>SQLDISCONNECT(0)
>lnResult = SQLCONNECT('DB1',.T.)
>IF lnResult < 1
> * Write message to errolog and quit
>ENDIF
>
>
>From the menu in MainMenuForm the user then opens a form(class), let's call it MyForm, which in it's load method opens a number of remote views with
>
>
>USE MyView1 IN 0 CONNSTRING lnSQl
>
>
>I'm using private datasessions, and the views are closed in the unload event of MyForm.
>
>When the MainForm(class) is closed by either a menu choice or clicking the close box, a CLEAR EVENTS is issued, control returns to Main.prg which calls SQLDISCONNECT(0), and that's where the error occurs.
>
>If I do not open MyForm, it shuts down normally.
>
>I hope this sheds a bit more light on this issue.
>
>
>
>
>>What version of VFP, Windows, and SQL Server are you using?
>>
>>Do the changes you are making through the changes commit? You might need to use a SQLCOMMIT(), depending on how much you have simplified your example.
>>
>>>Simplified version of the program:
>>>
>>>
>>>* Main prg
>>>Public lnHandle
>>>lnHandle = SQLCONNECT('SomeDataSource',.T.)
>>>
>>>oMainForm = CREATEOBJECT('MainmenuForm')
>>>READ Events
>>>
>>>CLOSE Database
>>>lnResult = SQLDISCONNECT(lnHandle)
>>>
>>>
>>>And that's where it dies with a fatal exception
>>>
>>>There used to be a problem like that in VFP 3.0, article 140613, but that's hopefully been fixed by now.
>>>
>>>
>>>TIA