Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Gianni Sassanelli
  Where is Gianni Sassanelli?
 Rome
 Italy
 Gianni Sassanelli
 To: Gianni Sassanelli
  Where is Gianni Sassanelli?
 Rome
 Italy
 Gianni Sassanelli
 Tags
Subject: RE: RECOVERY a SQL CONNECTION
Thread ID: 155332 Message ID: 155333 # Views: 1 # Ratings: 0
Version: Visual FoxPro 9 Category: Databases, Tables and SQL Server
Date: Sunday, December 30, 2007 2:00:58 PM         
   


I have maked a solution
>
 public nconn
 nconn = SQLSTRINGCONNECT([DRIVER=SQL Server;SERVER=MySqlServer;UID=sa;PWD=sa;APP=Microsoft Visual FoxPro;WSID=MYPCNAME;DATABASE=master])])
 
 FUNCTION CustomSqlExec
 LPARAMETERS CSTMT, cAlias, aCount
 LOCAL nResult
 nresult = SQLEXEC(nconn,CSTMT, cAlias, aCount)
 IF nResult > 0
 	RETU nResult
 ELSE
 	*!* in this case I woud want to inser code for testing if Connection to server was lost and then 
 	*!* 1 ) retry the connection 
 	*!* 2 ) Re-Execute the query
	Aerror(asqlerr)
	For x = 1 To Alen(asqlerr,2)
	If nvl(asqlerr[x,4],"") = "08S01"
	*!* Lost connection for NETWORKS Problem
		cConnStr = SQLGetprop(nconn,"ConnectString")
		SQLDisconnect(nconn)
		nconn= Sqlstringconnect(cConnStr)
		IF nconn > 0
			nresult = SQLEXEC(nconn,CSTMT, cAlias, aCount)
		ENDIF	
		EXIT
	ENDFOR
	RETU nResult
 ENDIF
 
 



Thanks the same

ENTIRE THREAD

RECOVERY a SQL CONNECTION Posted by Gianni Sassanelli @ 12/30/2007 1:03:53 PM
RE: RECOVERY a SQL CONNECTION Posted by Gianni Sassanelli @ 12/30/2007 2:00:58 PM