Update cookies preferences
Promotic

DbOpen - method of the PmaAdo object

Description:
Connection of the PmaAdo object to the database.
The connection is executed via the ADO Connection object, that is contained in the PmaAdo object. The parameters that are needed for connection are defined in the properties DbConnectionString and DbConnectionParams.
Syntax:
Object DbOpen([String sParams])
Parameters:
sParams[optional] (String) Additional parameters of the DbOpen method. Entries are in the KeyVal format, for example "return:map;".
"return:xxx;" (optional) - Specifies whether the method return value is a map containing multiple values (new procedure) or a single value (old procedure).
If not set, then the old procedure is used.
map - Returns a map (PmMap object) containing multiple returned values (new procedure) (e.g. Result, AffectedRows, ErrorCode, ErrorText).
Return value:
New procedure: Returns PmMap object with values in following items:
- "Result": flag indicating successful database connection:
true - Database connection successful
false - Database connection failed
- "ErrorCode": numeric error code where the 0 value means successful method execution (no error)
- "ErrorText": error text description


Old procedure: Returns flag indicating successful database connection:
true - Database connection successful
false - Database connection failed
Example:
Connection of the PmaAdo object ("/TestAdoDb") to the database ("pm_data"), for MS SQL Server (local instance named ".\SQLEXPRESS"), using the basic ADO Provider by the Microsoft company ("SQLOLEDB"), including the use of login name and password (MS SQL Server authentication).
JavaScriptVBScriptSelect and copy to clipboard

var oDb = pMe.Pm("/TestAdoDb");
oDb.DbConnectionString = "Provider=SQLOLEDB;Server=.\\SQLEXPRESS;Database=pm_data;uid=pm_admin;pwd=pmadmin;";
oDb.DbConnectionParams = "";
if (! oDb.DbOpen())
{
// ...
}

History:
Pm8.01.00: Created
Pm8.03.22: Returns the PmMap object with values in items "Result", "ErrorCode" and "ErrorText".
PROMOTIC 9.0.31 SCADA system documentation MICROSYS, spol. s r.o.

Send page remarkContact responsible person
© MICROSYS, spol. s r.o.