Description of handling PmDatabase object if table doesn't exist

If a database table doesn't exist, then it can be created by the methods PmDatabase.Create, ...

Caution! - these methods are not functional over the table accessed by ODBC.

If working with non-existing table (or non-existing database) the PmDatabase object must be closed e.g. by the PmDatabase.Close method (methods PmDatabase.Open,... cannot be used and also the On start configurator must be set on value Don't connect the database and don't open the table or it is necessary to close the table and the database by the PmDatabase.Close method before calling the PmDatabase.Create method).

Let's have established an object of the PmDatabase type in the PmRoot named "Database". Example of creating a table in the database:
VBScriptSelect and copy to clipboard

Dim oDb
Set oDb = pMe.Pm("/Database")
oDb.CreateField "columnText", 10, 180  '10 - string
oDb.CreateField "columnBool", 1, 0  '1 = Boolean
oDb.CreateField "columnReal", 6, 0  '6 = Single
oDb.CreateField "columnTime", 8, 0  '8 = Date

Thus created table can be treated in a standard way.

For the basic walkthroughs with the PmDatabase object see the set of examples in the \Pm\Examples\AppExamples\AppExamples folder.

PROMOTIC 8.3.30 SCADA system documentation - MICROSYS, spol. s r.o.

Send page remarkContact responsible person
© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice