dotConnect for DB2 Documentation
Devart.Data.DB2 Namespace / DB2Command Class / Clone Method
Example

In This Topic
    Clone Method (DB2Command)
    In This Topic
    Creates a new object that is a copy of the current DB2Command instance.
    Syntax
    'Declaration
     
    Public Function Clone() As DB2Command
    public DB2Command Clone()

    Return Value

    A new DB2Command object in which all property values are the same as the original.
    Remarks
    Use this method when you need to create a new DB2Command object that is absolutely like existing one.
    Example
    This example shows how to clone a DB2Command . To make sure all the properties are inherited, one of them (CommandText) is written to the console.
    public void CloneACommand()
    {
      DB2Command db2Command = new DB2Command("SELECT * FROM Dept");
            DB2Command db2Command2 = (DB2Command)db2Command.Clone();
      Console.WriteLine(db2Command2.CommandText);
    }
    Public Sub CloneACommand()
      Dim db2Command As New DB2Command("SELECT * FROM Dept")
      Dim db2Command2 As DB2Command = CType(db2Command.Clone(), DB2Command)
      Console.WriteLine(db2Command2.CommandText)
    End Sub
    See Also