PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → check Microsoft SQL connection
check Microsoft SQL connection
Iniciado por Andrea Fortune, 24,feb. 2019 09:29 - 1 respuesta
Publicado el 24,febrero 2019 - 09:29
Hello,
I'm working with an external Ms SQL server in LAN network via OLEDB connection.
The configuration works good and I'm able to read that database using queries with windev.
The problem is when the server is shut down, if the client execute a query windev crash's.
I want to avoid this, checking if the connection is working it can execute the query.
I need
1) something to check Hconnection status (I want to use a green icon if the connection is established)
2) something to use set a timeout (I tried to use something in the guide but I doesn't work)

Thanks
Publicado el 09,marzo 2019 - 15:49
Hi,
I always check the connection status with a procedure:
Procedure GetConnectiontoSql()
nConn is boolean

nConn = SQLConnect(gsserver,"","",gsdb,"OLEDB","SQLOLEDB","Trusted_Connection=YES")

IF nConn = False THEN
SQLInfo()
Error("The connection to the data source " + gsdb + " failed." + CR +
"Error code: " + SQL.Error)
END
RESULT nConn


Now you can set an icon.