Do you ever destroy the connection?  Leave the form could be a reason or
kill the app.


On Wed, Jun 5, 2013 at 4:42 PM, MB Software Solutions, LLC <
mbsoftwaresoluti...@mbsoftwaresolutions.com> wrote:

> On 6/4/2013 9:16 PM, Ted Roche wrote:
>
>> Oops. Hit 'Send' too soon.
>>
>
>
> Mike,
>
> Here's my GetHandle routine:
>
>         PROTECTED FUNCTION GetHandle(tlForce as Logical) as Integer
>         * Returns connection handle to caller.
>                 LOCAL liHandle as Integer, lcDSN as String, loException as
> Exception, liRetryCnt as Integer
>                 IF tlForce OR this.nHandle <= 0 THEN
>                         TRY
>                                 =SQLSETPROP(0, 'DispLogin', 3 ) &&
> suppress login info
>                                 =SQLSETPROP(0,"ConnectTimeOut"**,SQLTIMEOUT)
> && wait N seconds before timeout (mjb 08-04-06)
>                                 lcDSN = this.cSQLConnect
>                                 IF NOT EMPTY(lcDSN) THEN
>                                         liHandle = SQLSTRINGCONNECT(lcDSN)
>                                         IF SQLEXEC(liHandle,[select
> @@version as cVersion],"curVersion") = 1 THEN
>                                                 this.cDBCVersion =
> curVersion.cVersion
>                                         ELSE && attempt reconnection
>                                                 liRetryCnt = 1
>                                                 DO WHILE liHandle < 0 AND
> liRetrCnt <= RETRY_COUNT
>                                                         WAIT WINDOW
> TIMEOUT .5 "Re-attempting (" + ALLTRIM(STR(liRetryCnt)) + ") to connect to
> SQL database..."
>                                                         liHandle =
> SQLSTRINGCONNECT(lcDSN)
>                                                         IF
> SQLEXEC(liHandle,[select @@version as cVersion],"curVersion") = 1 THEN
>
> this.cDBCVersion = curVersion.cVersion
>                                                         ELSE
>
> MESSAGEBOX(this.cSystemName + " is unable to establish connection to the
> database.",16,"Unable to connect.")
>                                                                 liHandle =
> -99
>                                                         ENDIF
>                                                         liRetryCnt =
> liRetryCnt + 1
>                                                 ENDDO
>                                         ENDIF
>                                 ELSE
>                                         liHandle = -1
>                                 ENDIF
>
>                         CATCH TO loException
>                                 liHandle = -1
>                                 MESSAGEBOX(loException.**Message,16,"Problem
> getting handle.  " + ADMINMSG)
>                         ENDTRY
>                         this.nHandle = liHandle
>
>                 ELSE
>                         * mjb 02-04-08 verify that it's good
>                         IF SQLEXEC(this.nHandle,[select @@version as
> cVersion],"curVersion2") = 1 THEN && alright, good to go
>                                 liHandle = this.nHandle
>                         ELSE && force new handle via recursive call
>                                 WAIT WINDOW NOWAIT "Reattempting to
> connect..."
>                                 liHandle = this.GetHandle(.T.)
>                         ENDIF
>                 ENDIF && tlForce OR this.nHandle = 0
>
>                 * done with temp cursors
>                 USE IN SELECT("curVersion")
>                 USE IN SELECT("curVersion2")
>
>                 RETURN liHandle
>         ENDFUNC && GetHandle() as Integer
>
>
>
> --
> Mike Babcock, MCP
> MB Software Solutions, LLC
> President, Chief Software Architect
> http://mbsoftwaresolutions.com
> http://fabmate.com
> http://twitter.com/mbabcock16
>
> ______________________________**_________________
> Post Messages to: ProFox@leafe.com
> Subscription Maintenance: 
> http://mail.leafe.com/mailman/**listinfo/profox<http://mail.leafe.com/mailman/listinfo/profox>
> OT-free version of this list: http://mail.leafe.com/mailman/**
> listinfo/profoxtech <http://mail.leafe.com/mailman/listinfo/profoxtech>
> Searchable Archive: 
> http://leafe.com/archives/**search/profox<http://leafe.com/archives/search/profox>
> This message: http://leafe.com/archives/**byMID/profox/51AFB0E3.6060709@**
> mbsoftwaresolutions.com<http://leafe.com/archives/byMID/profox/51afb0e3.6060...@mbsoftwaresolutions.com>
> ** All postings, unless explicitly stated otherwise, are the opinions of
> the author, and do not constitute legal or medical advice. This statement
> is added to the messages for those lawyers who are too stupid to see the
> obvious.
>



-- 
Stephen Russell
Sr. Analyst
Ring Container Technology
Oakland TN

901.246-0159 cell


--- StripMime Report -- processed MIME parts ---
multipart/alternative
  text/plain (text body -- kept)
  text/html
---

_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/cajidmyl4j0c1qfnp4zv4-m2psymlwsu7hmkvgabnyw5nbou...@mail.gmail.com
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to