Welcome! Log In Create A New Profile

Advanced

WX Local storage (HF C/S and HF Clasic)

Posted by infos 
WX Local storage (HF C/S and HF Clasic)
December 28, 2019 05:33PM
Hi All

In my project I use HF SQL databases with connection to HF Server.
Is there a way to use the connection on my local computer and Server simultaneously?
Did anyone do something similar? Can it be connected to Server and local base (HF Clasic) at the same time?

This standard mode does not work simultaneously
HChangeDir(Base1, "C:\Local") and HChangeDir(Base2, ".\Server\")

[infosonline.net]



Edited 3 time(s). Last edit at 12/28/2019 05:42PM by infos.
Re: WX Local storage (HF C/S and HF Clasic)
December 29, 2019 07:25AM
Hi,

basically, you connect to a data source. Changing directories will not help at all.

// Declare connection variable
MyConnection is Connection
MyConnectionName is string


Connect to a HF C/S data source:

// Connection to HFCSDatabase
MyConnection..User = NoSpace(MyHFCSAdminName)
MyConnection..Password = NoSpace(MyHFCSAdminPassword)
MyConnection..Database = NoSpace(MyDatabaseName)
MyConnection..Server = MyServerAndPort
MyConnection..Provider = hAccessHFClientServer
MyConnection..Access = hOReadWrite
MyConnection..CursorOptions = hServerCursor+hDynamicCursor+hOptimisticCursor
MyConnection..ExtendedInfo = ""
MyConnection..CryptMethod = hCryptStandard

IF NOT HOpenConnection(MyConnection) THEN
Error("HFSQL: HOpenConnection: ","Die Verbindung zu "+MyServerAndPort + " kann nicht errichtet werden !",HErrorInfo(hErrFullDetails))
RETURN
END

MyConnectionName = MyConnection..Name

// Info("Connection "+MyConnectionName+" established successfully !","Database "+MyConnection..Database+" found / generated !")

// Die Verbindung aller Dateien einrichten:
WHEN EXCEPTION IN
HChangeConnection("*",MyConnection)
DO
// Fehler aufgetaucht:
EndProgram("HFSQL C/S: Fehler bei HChangeConnection aufgetreten !",HErrorInfo(hErrFullDetails))
END

IF NOT HModifyStructure("*",hmsNoCheck) THEN
Error("Fehler bei HModifyStructure aufgetreten!",HErrorInfo(hErrFullDetails))
END



Connect to a HF Classic data source

// Verbindung aufbauen, damit die Benutzerdatei gelesen werden kann!
MyConnection..User = "Admin"
MyConnection..Password = ""
MyConnection..Database = ""
MyConnection..Server = ""
MyConnection..Provider = hAccessHF7
MyConnection..Access = hOReadWrite
MyConnection..CursorOptions = hServerCursor+hDynamicCursor+hOptimisticCursor
MyConnection..ExtendedInfo = ""
MyConnection..CryptMethod = hCryptStandard
MyConnection..Source = NoSpace(MyPathToHFClassic)

IF NOT HOpenConnection(MyConnection) THEN
Error("HF Classic: HOpenConnection: ","Unable to connect to HF Classic-Dir: "+MyPathToHFClassic,HErrorInfo(hErrComplet))
RETURN
END

MyConnectionName = MyConnection..Name

// Die Verbindung aller Dateien einrichten:
WHEN EXCEPTION IN
HChangeConnection("*",MyConnection)
DO
// Fehler aufgetaucht:
EndProgram("HFSQL C/S: Fehler bei HChangeConnection aufgetreten !",HErrorInfo(hErrFullDetails))
END

IF NOT HModifyStructure("*",hmsNoCheck) THEN
Error("Fehler bei HModifyStructure aufgetreten!",HErrorInfo(hErrFullDetails))
END

Kind regards,
Guenter Predl
office@windev.at



Edited 1 time(s). Last edit at 12/29/2019 07:28AM by gpredl.
Re: WX Local storage (HF C/S and HF Clasic)
December 29, 2019 05:16PM
Can I use both connections at the same time without the command HChangeConnection("*",MyConnection)

It needs a data file into which I will temporarily store the data locally. For now, I keep that information in the memory of the looper control

Thank you Mr. Predl

[infosonline.net]



Edited 5 time(s). Last edit at 12/29/2019 05:32PM by infos.
Re: WX Local storage (HF C/S and HF Clasic)
December 29, 2019 05:34PM
Hi, of course! You just have to have two different connection-variables!

Kind regards,
Guenter Predl
office@windev.at
Re: WX Local storage (HF C/S and HF Clasic)
December 29, 2019 07:10PM
Greeting

Do you mean two different connections?
MyConnection //HF C/S
MyConnection2 //HF Clasic

[infosonline.net]



Edited 1 time(s). Last edit at 12/29/2019 07:18PM by infos.
Re: WX Local storage (HF C/S and HF Clasic)
December 30, 2019 07:06AM
Yes! See [help.windev.com]

Kind regards,
Guenter Predl
office@windev.at
Re: WX Local storage (HF C/S and HF Clasic)
December 30, 2019 10:42AM
Greeting

To work flawlessly

Thank you very much Mr. Predl

[infosonline.net]
Author:

Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: