PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → [WB19] hModifyStructure
[WB19] hModifyStructure
Iniciado por guest, 21,abr. 2016 13:05 - 5 respuestas
Publicado el 21,abril 2016 - 13: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
Publicado el 21,abril 2016 - 15:28
Hi Piet,

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

Regards,

Joris.
Publicado el 21,abril 2016 - 18:41
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
Publicado el 22,abril 2016 - 10:52
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
Publicado el 22,abril 2016 - 11:34
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
Publicado el 22,abril 2016 - 12:25
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