Description
Creates an instance of a component running on the COM+ server. This function is called from within a component instance running on COM+.
Applies to
TransactionServer objects
Syntax
transactionserver.CreateInstance (objectvariable {, classname } )
Argument |
Description |
---|---|
transactionserver |
Reference to the TransactionServer service instance. |
objectvariable |
A global, instance, or local variable whose datatype is the same class as the object being created or an ancestor of that class. |
classname (optional) |
A string whose value is the name of the class datatype to be created. For COM+ components, you can optionally prepend a ProgID followed by a period to the class name (for example, "PowerBuilder.HTMLDataWindow". |
Return value
Long.
Returns 0 if it succeeds and one of the following values if an error occurs:
50 -- Distributed service error
52 -- Distributed communications error
53 -- Requested server not active
54 -- Server not accepting requests
55 -- Request terminated abnormally
56 -- Response to request incomplete
57 -- Not connected
62 -- Server busy
Usage
The CreateInstance function on the TransactionServer context object allows you to access other COM+ components running on the current server. The created instance inherits all the transaction and security attributes of the current object.
The CreateInstance function on the TransactionServer context object uses the same user and password information that applies to the component from which it is called.
Before you can use the transaction context service, you need to declare a variable of type TransactionServer and call the GetContextService function to create an instance of the service.
Examples
This example shows the syntax for creating an instance of a COM component:
Integer rc OleObject lole TransactionServer lts lole = create OleObjectrc = this.GetContextService("TransactionServer", lts) IF rc <> 1 THEN return "Error from GetContextService " + String (rc) END IF // PBCOM is the ProgID, n_genapp is the class namerc = lts.CreateInstance(lole, "PBCOM.n_genapp") IF rc <> 0 THEN return "Error from CreateInstance " + String (rc) END IFiole.my_func ()
See also