Clone Method (MySqlCommand)
Creates a new object that is a copy of the current
MySqlCommand instance.
Return Value
A new
MySqlCommand object in which all property values are the same as the original.
This example shows how to clone a
MySqlCommand . To make sure all the properties are inherited, one of them (CommandText) is written to the console.
|
|---|
public void CloneACommand()
{
MySqlCommand mySqlCommand = new MySqlCommand("SELECT * FROM Test.Dept");
MySqlCommand mySqlCommand2 = (MySqlCommand)mySqlCommand.Clone();
Console.WriteLine(mySqlCommand2.CommandText);
} |
|
|---|
Public Sub CloneACommand()
Dim mySqlCommand As New MySqlCommand("SELECT * FROM Test.Dept")
Dim mySqlCommand2 As MySqlCommand = CType(mySqlCommand.Clone(), MySqlCommand)
Console.WriteLine(mySqlCommand2.CommandText)
End Sub |