Copy Method for LCConnection

This method makes a copy of an existing connection, including all property values. Note that while all properties are copied, the current state of the connection and result set are not copied.

Defined In

LCConnection

Syntax

Set newConnection = lcConnection.Copy ()

Parameters

Parameter

Description

lcConnection

The connection object that you want to copy.

Return Value

Value

Description

newConnection

The copy of the lcConnection object.

Example

Option Public
Uselsx "*lsxlc" 
Sub Initialize
  Dim session As New LCSession
     ' In an LEI Scripted Agent, use the following syntax instead:
     ' Dim session As New LCSession ("mySession")
  Dim connect1 As New LCConnection  ("db2") 
  Dim connect2 As LCConnection

  ' set the appropriate properties to connect to DB2
  ' note the use of dynamic properties to do this
  connect1.Database = "Gold"
  connect1.Userid = "JDoe"
  connect1.Password = "xyzzy"

  ' now copy the connect
  Set connect2 = connect1.Copy
  If (connect2.Database = connect1.Database) Then
    Print "The copy of connection has the same database as the original."
  Else
    Print "The copy of connection has a different database from the original."
  End If
End Sub

Example Output

The copy of connection has the same database as the original.