You should never rely on the connection to be available 24/7. A couple of options:
- Make the connection every time it's needed
- Test the connection when you need it. It if's closed or timed out, reconnect
>I have a situation that is bugging me and my client
>
>I have a Time Attendance Clock that runs 24/7.
>
>I make a a connection using SQLSTRINGCONNECT
>
>
>lcConnStr = "Driver=SQL Server;Server=ServerName;DATABASE=MyDB;uid=User;pwd=*****"
>lnConn = SQLSTRINGCONNECT(lcConnStr)
>
>
>
>and everytime a employee punches I send the punch to the backend using SQLEXEC
>
>
>llReturnVal = SQLEXEC(lnConn,lcSQLStatement)
>
>
>
>Now here's my issue. and it has became a pain in the rear:
>
>all of a sudden, randomly the connection to the backend breaks and since lnConn is a Connection Handler, it becomes useless. and Employees can't punch
>
>I know i can restore the connection, but this implies a lot of reloading of data since i am using Cursoradapters too.
>
>my questions to you all:
>
>1. what are the possible reasons why a connection to MSSQL breaks? Network? My app? VFP? CursorAdapters?
>2. is there any way to monitor this?
>3. is there any other approach, better and faster?
>
>
>Karben Selim Mejia
>
>Honduras, Central America
>The very centre of the world
Craig Berntson
MCSD, Microsoft .Net MVP, Grape City Community Influencer