PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → [WM22] HdeclareExternal
[WM22] HdeclareExternal
Iniciado por guest, 08,jul. 2017 16:18 - 2 respuestas
Publicado el 08,julio 2017 - 16:18
Hi all,

Anyone succeeded in using HDeclareExternal on an Android Device ?

This is the code I use. Runs OK in the simulator, but on the device I get just a message " is stopped" without any further information. First, I do get the "Connection OK" message, so making the connection is OK.

Thx,
Bart

ds is Data Source
r is boolean
Conn is Connection

Conn..User = "myUserName"
Conn..Password = "myPassword"
Conn..Server = "192.168.0.128"
Conn..Database = "myDB"
Conn..Provider = hAccessHFClientServer
Conn..Access = hOReadWrite

IF NOT HOpenConnection(Conn) THEN
Error(HErrorInfo())
RETURN
ELSE
Info("Connection OK")
END

r= HDeclareExternal("./Artikel.FIC","ds","conn")
IF NOT r THEN
Error(HErrorInfo())
HCloseConnection(Conn)
RETURN
END

HReadFirst(ds)
Info(ds.oms)
HCancelDeclaration(ds)
HCloseConnection(Conn)
Publicado el 08,julio 2017 - 16:40
Hi Bart

WHERE is your file?

I suspect that the "./" may be your problem under android.

Best regards
Publicado el 08,julio 2017 - 17:16
Hi Fabrice,

Found the solution. The problem was the alias I've used in HDeclareExternal.
Now I use as alias the real name of my file in my external database.

Thanks,
Bart

Solved it this way:


DS is data source
R is boolean

R= HDeclareExternal("./Artikel.FIC","Artikel","conn")
IF NOT R THEN
CloseRemoteConnection()
DisableActiveScanning()
Error(herrorinfo())
RETURN
END

R = HExecuteSQLQuery(DS,hQueryDefault,StringBuild("select oms from artikel where artikelkode = '%1'", aArtikelkode))
IF NOT R THEN
HCancelDeclaration("Artikel")
HCancelDeclaration(DS)
CloseRemoteConnection()
DisableActiveScanning()
Error(hErrorInfo())
RETURN
END

HReadFirst(DS)
IF HFound(DS) THEN
aOms = DS.oms
ELSE
aOms = "Artikel niet gevonden."
END
hCancelDeclaration(DS)
hCancelDeclaration("Artikel")