Promotic
WikipediaLinkedInYoutubeTwitterFacebook

DbOpen - method of object PmAdo

Description:
Connecting the PmAdo object to the database. The connection is executed via the ADO Connection object, that is contained in the PmAdo object. The parameters that are needed for connection are defined in the properties DbConnectionString and DbConnectionParams.
Syntax:
DbOpen([sParams As String]) As Object
Calling:
b = oDb.DbOpen(sParams)
Parameters:
sParams[optional] (String) Additional parameters of the DbOpen method. Entries are in format KeyVal, for example "return:map;".
"return:xxx;" (optional) - Specifies whether the method returned 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) containing multiple returned values (new procedure) (e.g. Result, AffectedRows, ErrorCode, ErrorText).
Return Values:
New procedure: Returns object PmMap with values in following items:
- "Result": attribute indicating successful database connection:
true - database connection successful
false - database connection failed
- "ErrorCode": numeric error code where the 0 value signals successful method execution (no error)
- "ErrorText": error text description
 
Old procedure: Returns attribute indicating successful database connection:
true - database connection successful
false - database connection failed
Example:
Connecting the PmAdo 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 authentization).
VBScriptSelect and copy to clipboard

Dim oDb
Set oDb = pMe.Pm("/TestAdoDb")
oDb.DbConnectionString = "Provider=SQLOLEDB;Server=.\SQLEXPRESS;Database=pm_data;uid=pm_admin;pwd=pmadmin;"
oDb.DbConnectionParams = ""
If Not oDb.DbOpen() Then
  '...
End If
PROMOTIC 8.3.26 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