>>I need the ability to ensure that my program when logged in has not lost its connection to the SQL server. Is there a way to do this all the time without slowing down the program, and if a loss of connectino is found have the program ask the user to relogin again? Thanks.
>>
>>Gary
>
>I use code like the following in SQL class to check the result of each SQLPassthrough
>request and if the connection was lost try to reconnect. This works well with SQLPassthrough
>and doesn't cause much overhead, but it wouldn't work so well on Views.
>
>
>
>THIS.nSQLResult = SQLExec(THIS.nSQLHandle,lcSQL,THIS.cSQLCursor)
>IF THIS.nSQLResult = -1
> THIS.lError = .t.
> THIS.FillErrors()
>
> *** Try Reconnecting and re-executing request
> IF (THIS.nODBCErrorNo=14) AND ;
> THIS.Connect(THIS.cConnectString)
> THIS.nSQLResult = SQLExec(THIS.nSQLHandle,lcSQL,THIS.cSQLCursor)
> IF THIS.nSQLResult = -1
> THIS.lError = .t.
> THIS.FillErrors()
> ELSE
> THIS.FillErrors("CLEAR")
> ENDIF
> ENDIF
>ELSE
> THIS.lError = .F.
> IF SQLCommit(THIS.nSQLHandle) = -1
> THIS.lError = .T.
> THIS.FillErrors()
> ENDIF
>ENDIF
>
>RETURN THIS.nSQLResult
>
>
>This is still a little preliminary - there are a few errors that can cause problems
>other than ODBC error 14, but that's the most common one I've run into and this code
>works for that...
>
>+++ Rick ---
Thanks Rick,
I'll see if I can adapt this to what I'm doing and I'll post what I come up with to you.
Thanks and have a happy holidays!
Gary