This PowerShell function returns an open connection to a EULANDA database. This function requires an EULANDA ERP system. Source code on GitHub.
Get-Conn [[-conn] <Object>] [[-udl] <String>] [[-connStr] <String>] [<CommonParameters>]
The function returns an opened Connection object. If a connection is already passed as input parameter, it will be used. If it was closed, it will be opened automatically. Alternatively a UDL file or a Connection-String can be specified to access the database.
Example 1:Returns an opened connection object #
PS C:\> $conn = Get-Conn -udl "C:\temp\Eulanda_1 JohnDoe.udl"
Based on a UDL file, an opened Connection object is returned and assigned to the
$conn variable. This can then be used to make many other calls by continuing to use the same connection.
The connection can be established via an existing ADO object of the type ‘ADODB.Connection’. If the connection is already open, it remains open even after the function has been executed. If it was closed, it will be closed again after the function has been executed.
Type: Object Parameter Sets: (All) Aliases: Required: False Position: 0 Default value: None Accept pipeline input: False Accept wildcard characters: False
ConnectionString can be specified here, with which a database can be opened.
Type: String Parameter Sets: (All) Aliases: Required: False Position: 2 Default value: None Accept pipeline input: False Accept wildcard characters: False
Alternatively to a connection, a string to a UDL file can be specified. In this case an ADO object is created and closed again at the end of the function.
Type: String Parameter Sets: (All) Aliases: Required: False Position: 1 Default value: None Accept pipeline input: False Accept wildcard characters: False
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.