PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 25 → HOPENCONNECTION Exemplo com porta diferente de 4900
HOPENCONNECTION Exemplo com porta diferente de 4900
Iniciado por Boller, 25,oct. 2022 03:44 - No hay respuesta
Miembro registrado
4.521 mensajes
Publicado el 25,octubre 2022 - 03:44
//use source para mudar de porta
GLOBAL
Banco is string = INIRead("Database","Banco","",fCurrentDir()+"\ConfigDB.ini")
DNS_IP is string = INIRead("Database","DNS-IP","",fCurrentDir()+"\ConfigDB.ini")
Porta is string = INIRead("Database","Porta","",fCurrentDir()+"\ConfigDB.ini")
Usuario is string = INIRead("Database","Usuario","",fCurrentDir()+"\ConfigDB.ini")
Senha is string = INIRead("Database","Senha","",fCurrentDir()+"\ConfigDB.ini")

IF Usuario = "" AND Senha = "" THEN
Open(WIN_ConfigDatabase)
END

MyHfsql01 is Connection
MyHfsql01..Provider = hAccessHFClientServer
MyHfsql01..Database = Banco
MyHfsql01..Server = DNS_IP
MyHfsql01..Source = DNS_IP +":"+ Porta //em source define a porta
MyHfsql01..User = Usuario
MyHfsql01..Password = Senha


HModifyStructure("*")

HCreationIfNotFound("*")

IF HOpenConnection(MyHfsql01) = True THEN

IF HChangeConnection("*",MyHfsql01) = True THEN
ToastDisplay("Conexao com sucesso!",toastLong,vaMiddle,haCenter)
ELSE
Error(HErrorInfo())
END

ELSE
Error(HErrorInfo())
END


--
Adriano José Boller
______________________________________________
Consultor e Representante Oficial da
PcSoft no Brasil
+55 (41) 99949 1800
adrianoboller@gmail.com
skype: adrianoboller
http://wxinformatica.com.br/