As400Program(AdgConnection, string)

Construct an instance of the As400Program object and set the Connection and ProgramPath properties.

        [C#]
public As400Program(
   AdgConnection Connection,
   string ProgramPath
);
      
        [Visual Basic] 
Public Sub New( _
   ByVal Connection As AdgConnection _
   ByVal ProgramPath As String _
)
      
        [Visual RPG]
 BegConstructor Acess(*Public)
   DclSrParm Connection Type(AdgConnection)
   DclSrParm ProgramPath Type(*String)
      
Parameters
Connection
An AdgConnection object used to set the value of the Connection property.
ProgramPath
A string used to set the value of the ProgramPath property.
Exceptions

ASNA.DataGate.Common.dgException is thrown to signal normal procedural conditions, in addition to error conditions. The following table summarizes these conditions, and the corresponding value of the dgException.Error property.


Value of
dgException.Error
Condition

dgEINVARG

The reference being assigned to Connection is null, or is an AdgConnection object whose State property is not equal to System.Data.ConnectionState.Open (see Remarks).

dgEmINVSQLOP

The value of Connection is not a valid connection for use with As400Program.

Remarks

This constructor invokes the default constructor and then sets property values using the given parameters. The value of the Connection property is set with the Connection parameter, and the value of the ProgramPath property is set with the ProgramPath parameter. The parameter list is initialized to length zero.

If Connection is set with a null value or is an AdgConnection instance that is unconnected or incompatible with As400Program, an exception is raised. Use AdgConnection.Open to open a connection to an IBM i database provider prior to setting Connection. The value of the ProgramPath parameter is not validated by this constructor.

Examples
        
          [C#]
        
  /* Here, "ProdDB" is an initialized AdgConnection and
   * Call400 is a valid IBM i program file. */
  As400Program prog = new As400Program(ProdDB, "*Libl/Call400");
        
          [Visual Basic]
        
  ' Here, "ProdDB" is an initialized AdgConnection and
  ' Call400 is a valid IBM i program file.
  Dim prog As New As400Program(ProdDB, "*Libl/Call400");
        
          [Visual RPG]
        
  /* Here, "ProdDB" is an initialized AdgConnection and
   * Call400 is a valid IBM i program file. */
  DclFld prog Type(As400Program)
  prog = *New As400Program(ProdDB, "*Libl/Call400")
Requirements

Namespace: ASNA.DataGate.Client

Assembly: ASNA DataGate Client

Platforms: Windows Server 2008 R2, Windows Server 2012, Windows 7, Windows 8 Pro, Windows 8.1 Pro, Windows 10

See Also