Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
6
Erster Beitrag:
vor 1 Jahr, 7 Monaten
Letzter Beitrag:
vor 1 Jahr, 7 Monaten
Beteiligte Autoren:
Piet van Zanten, Steven Sitas, Joris

[WB19] hModifyStructure

Startbeitrag von Piet van Zanten am 21.04.2016 11:05

Hi,

I use hModifyStructure after opening a connection to a specific database and after hChangeConnection for the files.
Then Webdev throws an error: Unable to open file.
Why doesn't hModifyStructure use the connection?

Regards,
Piet

Antworten:

Hi Piet,

Maybe the version of your database is more recent than your analysis?

Regards,

Joris.

von Joris - am 21.04.2016 13:28
Hi Piet,
see the following code ....

IF NOT HOpenConnection(myconnect) THEN
EndProgram("connection info is probably wrong")
END
IF NOT HChangeConnection("*",myconnect) THEN
EndProgram("what happened ????")
END

WHEN EXCEPTION IN
HCreationIfNotFound("*",hChangeCharset)
DO
SWITCH HError()
CASE 70016:
Info("I will now reorganize the data ...")
HModifyStructure("*")
Info("Data has been reorganized")
Info("the application will restart")
RestartProgram()
OTHER CASE:
Error("HFSQL error: " + HError())
EndProgram()
END
END

von Steven Sitas - am 21.04.2016 16:41
Hi,

I'm sorry, some part of the error message was truncated by the forum software because of the < and >.
The full message is:

Unable to open <dbname\C:\Myproject\Data\MyFile.FIC> file

Where dbname is the name of the database.

I do a hModifyStructure on a single file, so I specify the logical file name.
The problem is that according to the error message WB seems to add a physical path to the logical file name instead of just using the database specified in the connection.
I do the hModifyStructure in the initialization of the project, just after establishing the connection.
The connection is ok, because the project runs normally if I remove the hModifyStructure.

Meanwhile I just created a batch file to run WDModfic with commandline options.
So there's always a workaround, but it puzzles me why the above does not work.

edit: BTW, there's no such directory C:\Myproject\Data on my drive.

Regards,
Piet

von Piet van Zanten - am 22.04.2016 08:52
Hi Piet,

I used to have this kind of problems with hModifyStructure and I solved them doing the following:

1) make sure your database info DOES NOT come from your analysis
like the name, address etc
I use something like this in my Project code:
gsServer = INIRead("CONNECT","SERVER","xx.xx ...:4900",fWebDir+"\myapp.ini")
gsDatabase =INIRead ...

2) assign the above values to your connection

3) use the code I posted in my previous post

Don't try to use HModifyStructure on only ONE file.
Let HModifyStructure work on ALL files ...

Do the above even if you are using Classic HF.
And don't forget that hModifyStructure alone, will not fix the links on a HFSQL C/S database.

Steven Sitas

von Steven Sitas - am 22.04.2016 09:34
Hi Steven,

I use similar code for the connection, reading from ini file, don't use analysis info.
I'll stick with WDModfic then.

Thanks,
Piet

von Piet van Zanten - am 22.04.2016 10:25
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.