Avatar of b001
b001
Flag for Afghanistan asked on

vfp9 sql remote connection

HI Experts
I am using the following connection string from fvp9 to connect to a remote sql database.

FMS_SERVERIP= '235,256,258,99' my remote sql server ip
      lcStr = "Driver={SQL SERVER};Server=&FMS_SERVERIP;Database=Group;UID=b001;pwd=b00158;Trusted_Connection=no;"
 try
      lnHandle = Sqlstringconnect(lcStr)
      lnResult = SQLExec(lnHandle, "SELECT * FROM message ", "cOutData1")

CATCH
        wait window 'no sql connection'
ENDTRY

it works fine but if I lost the internet connection it does not goto my catch option  instead it comes back with Microsoft SQL Server Login connction failed error
when I click ok it pops up another screen and gives me the oprion to change login id and password then try to connect again.

What I would  like to happend when the connection fails is to goto  catch option ,  wait window 'no sql connection'
Please help
Thanks
FoxProMicrosoft SQL Server

Avatar of undefined
Last Comment
Olaf Doschke

8/22/2022 - Mon
Cyril Joudieh

lnHandle = Sqlstringconnect(lcStr)
IF lnHandle > 0
     WAIT WINDOW "There is connection"
ELSE
     WAIT WINDOW "There is no connection"
ENDIF
ASKER CERTIFIED SOLUTION
Olaf Doschke

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck