AdgFactory.NewDirectory Method

The NewDirectory method creates a new instance of IDirectory representing a database library for object management functions.

        [C#]
public IDirectory NewDirectory(
   AdgConnection cn
   string PathName
);
      
        [Visual Basic] 
Public Sub NewDirectory(_ 
   ByVal cn As AdgConnection_
   ByVal PathName As string_ 
) As IDirectory
      
        [Visual RPG]
  BegFunc NewDirectory Access(*Public) Type(IDirectory)
   DclSrParm cn Type(AdgConnection)
   DclSrParm PathName Type(*string)
      
Parameters

cn

An instance of AdgConnection representing a database connection to the server.

PathName

String. The path name of a new or existing database library object.

Returns

An instance of an IDirectory object.

Exceptions
Exception Type Condition

NullReferenceException

The cn and/or PathName parameters are null references.

dgException

See table below.

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

dgEmINVSQLOP

The AdgConnection specified is a connection to an SQL Server database provider, and DCS currently does not support the IDirectory interface for those providers.

Remarks

This method creates a new IDirectory based upon a new or existing database library (whose path is specified by PathName). The database containing the library is specified as cn, an AdgConnection object. Note that this method does not throw an exception if PathName and cn do not reference a valid, pre-existing database library. Subseqent usage of the returned IDirectory object's methods may raise such exceptions, however.

To create a new library, first call NewDirectory with the desired name for the new library in PathName. Then, with the IDirectory reference returned, call the Create method. A database library may also be created via AdgFactory.ReadXml.

If the State property of the cn parameter is not ConnectionState.Open, NewDirectory may temporarily open the database provider connection, via AdgConnection.Open. In this case only, upon successful return from NewDirectory, the State property of cn will be ConnectionState.Closed.

Requirements

Namespace: ASNA.DataGate.Client

Assembly: ASNA DataGate Client

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

See Also