PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

  • Updating the structure of the files
HModifyStructure (Example)
Updating the structure of the files
This example is used to update the structure of all the files if necessary.
sListOfErrors is string
// Strict check of the structure of files
HCheckStructure("*", hIdentical)
// For all the files
FOR EACH STRING sAFileName OF HListFile() SEPARATED BY CR
WHEN EXCEPTION IN
// Open or create the data file
HCreationIfNotFound(sAFileName)
DO
// Problem
// Is there a difference of structure?
IF HError(hErrCurrent) = 70016 THEN
// Error 70016: THE FILE DOES NOT CORRESPOND TO ITS DESCRIPTION
ToastDisplay("Updating the structure of the file <" + ...
sAFileName + "> in progress...", toastShort, vaMiddle, haCenter)
// Update the structure of the file
IF NOT HModifyStructure(sAFileName) THEN
// Failure updating the structure of the file
sListOfErrors += [CR] + ...
"- Error while modifying the structure for the file <" + ...
sAFileName + ">: " + HErrorInfo()
END
ELSE
// Errors other than a difference of structure
sListOfErrors += [CR] + "- Error while accessing the file <" + ...
sAFileName + ">: " + HErrorInfo()
END
END
END

// Compatible check of the file structure
// Therefore, the "most common" modifications allow
// to use the application (see HCheckStructure)
HCheckStructure("*", hCompatible)

// Errors occurred?
IF sListOfErrors <> "" THEN
// Message in order to warn
IF NOT YesNo("Errors occurred while opening the files: " + CR + ...
sListOfErrors + CR +...
"Continue the application?") THEN
EndProgram()
END
END
Minimum required version
  • Version 17
This page is also available for…
Comments
Click [Add] to post a comment