Link to home
Create AccountLog in
Avatar of b001
b001Flag 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
Avatar of Cyril Joudieh
Cyril Joudieh
Flag of Lebanon image

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

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer