PC SOFT

GRUPOS DE DISCUSSÃO PROFISSIONAL
WINDEVWEBDEV e WINDEV Mobile

Inicio → WINDEV 2024 → check Microsoft SQL connection
check Microsoft SQL connection
Iniciado por Andrea Fortune, fev., 24 2019 9:29 AM - 1 resposta
Publicado em fevereiro, 24 2019 - 9:29 AM
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 em março, 09 2019 - 3:49 PM
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.