<docs>
  <ClassSummary>
    <summary>Represents a SQL statement to execute against a MySQL database. This class cannot be inherited.</summary>
    <remarks>
      The <see cref="MySqlCommand"/> object includes the following methods for executing commands at a MySQL database:
      <list type="table">
        <listheader>
          <term>Item</term>
          <term>Description</term>
        </listheader>
        <item>
          <term>
            <see cref="ExecuteReader"/>
          </term>
          <description>Executes commands that return rows.</description>
        </item>
        <item>
          <term>
            <see cref="ExecuteNonQuery"/>
          </term>
          <description>Executes commands such as SQL INSERT, DELETE, and UPDATE statements.</description>
        </item>
        <item>
          <term>
            <see cref="ExecuteScalar"/>
          </term>
          <description>Retrieves a single value (for example, an aggregate value) from a database.</description>
        </item>
      </list>

      You can reset the <see cref="CommandText"/> property and reuse the <see cref="MySqlCommand"/>
      object. However, you must close the <see cref="MySqlDataReader"/> object before you can execute a new or previous command.

      If an exception of type <see cref="MySqlException"/> is generated by the method executing <see cref="MySqlCommand"/>,
      the <see cref="MySqlConnection"/> instance remains open. It is the responsibility of the programmer to close the connection.

      <note>
        Using the '@' symbol for paramters is now the preferred approach although the old pattern of using
        '?' is still supported.  Please be aware that using '@' can cause conflicts when user variables
        are also used. For more information, see the documentation on the <b>AllowUserVariables</b> connection string option.
      </note>
    </remarks>

    <example>
      The following example creates an instance each of <see cref="MySqlCommand"/> and <see cref="MySqlConnection"/>.
      The <see cref="MySqlConnection"/> object opens a connection and then is set as the <see cref="Connection"/>
      property for the <see cref="MySqlCommand"/>. The example then calls the <see cref="ExecuteNonQuery"/> method, 
      passes to it a connection string and a query string that consists of a SQL INSERT statement, and closes the connection.
      <code lang="vbnet">
        Public Sub InsertRow(myConnectionString As String)
          &quot; If the connection string is null, use a default.
          If myConnectionString = "" Then
            myConnectionString = "Database=Test;Data Source=localhost;User Id=username;Password=pass"
          End If
          
          Dim myConnection As New MySqlConnection(myConnectionString)
          Dim myInsertQuery As String = "INSERT INTO Orders (id, customerId, amount) Values(1001, 23, 30.66)"
          Dim myCommand As New MySqlCommand(myInsertQuery)
          myCommand.Connection = myConnection
          myConnection.Open()
          myCommand.ExecuteNonQuery()
          myCommand.Connection.Close()
        End Sub
      </code>
      <code lang="C#">
        public void InsertRow(string myConnectionString)
        {
          // If the connection string is null, use a default.
          if(myConnectionString == "")
          {
            myConnectionString = "Database=Test;Data Source=localhost;User Id=username;Password=pass";
          }
          
          MySqlConnection myConnection = new MySqlConnection(myConnectionString);
          string myInsertQuery = "INSERT INTO Orders (id, customerId, amount) Values(1001, 23, 30.66)";
          MySqlCommand myCommand = new MySqlCommand(myInsertQuery);
          myCommand.Connection = myConnection;
          myConnection.Open();
          myCommand.ExecuteNonQuery();
          myCommand.Connection.Close();
        }
      </code>
    </example>
  </ClassSummary>

  <ctor1>
    <overloads>
      <summary>
        Initializes a new instance of the MySqlCommand class.
      </summary>
      <example>
        The following example creates a MySqlCommand and sets some of its properties.
        <para></para>
        <note>
          This example shows how to use one of the overloaded
          versions of the MySqlCommand constructor. For other examples that might be available,
          see the individual overload topics.
        </note>

        <code lang="vbnet">
          Public Sub CreateMySqlCommand()
            Dim myConnection As New MySqlConnection _
            ("Persist Security Info=False;database=test;server=myServer")
            myConnection.Open()
            Dim myTrans As MySqlTransaction = myConnection.BeginTransaction()
            Dim mySelectQuery As String = "SELECT * FROM MyTable"
            Dim myCommand As New MySqlCommand(mySelectQuery, myConnection, myTrans)
            myCommand.CommandTimeout = 20
          End Sub
        </code>
        <code lang="C#">
          public void CreateMySqlCommand()
          {
            MySqlConnection myConnection = new MySqlConnection("Persist Security Info=False;database=test;server=myServer");
            myConnection.Open();
            MySqlTransaction myTrans = myConnection.BeginTransaction();
            string mySelectQuery = "SELECT * FROM myTable";
            MySqlCommand myCommand = new MySqlCommand(mySelectQuery, myConnection,myTrans);
            myCommand.CommandTimeout = 20;
          }
        </code>
      </example>
    </overloads>


    <summary>
      Initializes a new instance of the MySqlCommand class.
    </summary>
    <remarks>
      The base constructor initializes all fields to their default values. The
      following table shows initial property values for an instance of <see cref="MySqlCommand"/>.
      <list type="table">
        <listheader>
          <term>Properties</term>
          <term>Initial Value</term>
        </listheader>
        <item>
          <term>
            <see cref="CommandText"/>
          </term>
          <term>empty string ("")</term>
        </item>
        <item>
          <term>
            <see cref="CommandTimeout"/>
          </term>
          <term>0</term>
        </item>
        <item>
          <term>
            <see cref="CommandType"/>
          </term>
          <term>CommandType.Text</term>
        </item>
        <item>
          <term>
            <see cref="Connection"/>
          </term>
          <term>Null</term>
        </item>
      </list>
      <para>
        You can change the value for any of these properties through a separate call to
        the property.
      </para>
    </remarks>
    <example>
      The following example creates a <see cref="MySqlCommand"/> and
      sets some of its properties.

      <code lang="vbnet">
        Public Sub CreateMySqlCommand()
          Dim myCommand As New MySqlCommand()
          myCommand.CommandType = CommandType.Text
        End Sub
      </code>
      <code lang="C#">
        public void CreateMySqlCommand()
        {
          MySqlCommand myCommand = new MySqlCommand();
          myCommand.CommandType = CommandType.Text;
        }
      </code>
    </example>
  </ctor1>

  <ctor2>
    <summary>
      Initializes a new instance of the <see cref="MySqlCommand"/> class with the text of the query.
    </summary>
    <param name="cmdText">The text of the query.</param>
    <remarks>
      When an instance of <see cref="MySqlCommand"/> is created,
      the following read/write properties are set to initial values.

      <list type="table">
        <listheader>
          <term>Properties</term>
          <term>Initial Value</term>
        </listheader>
        <item>
          <term>
            <see cref="CommandText"/>
          </term>
          <term>
            <i>cmdText</i>
          </term>
        </item>
        <item>
          <term>
            <see cref="CommandTimeout"/>
          </term>
          <term>0</term>
        </item>
        <item>
          <term>
            <see cref="CommandType"/>
          </term>
          <term>CommandType.Text</term>
        </item>
        <item>
          <term>
            <see cref="Connection"/>
          </term>
          <term>Null</term>
        </item>
      </list>
      <para>
        You can change the value for any of these properties through a separate call to
        the property.
      </para>
    </remarks>
    <example>
      The following example creates a <see cref="MySqlCommand"/> and
      sets some of its properties.

      <code lang="vbnet">
        Public Sub CreateMySqlCommand()
          Dim sql as String = "SELECT * FROM mytable"
          Dim myCommand As New MySqlCommand(sql)
          myCommand.CommandType = CommandType.Text
        End Sub
      </code>
      <code lang="C#">
        public void CreateMySqlCommand()
        {
          string sql = "SELECT * FROM mytable";
          MySqlCommand myCommand = new MySqlCommand(sql);
          myCommand.CommandType = CommandType.Text;
        }
      </code>
    </example>
  </ctor2>

  <ctor3>
    <summary>
      Initializes a new instance of the <see cref="MySqlCommand"/> class
      with the text of the query and a <see cref="MySqlConnection"/>.
    </summary>
    <param name="cmdText">The text of the query.</param>
    <param name="connection">
      A <see cref="MySqlConnection"/> that represents the
      connection to an instance of SQL Server.
    </param>
    <remarks>
      When an instance of <see cref="MySqlCommand"/> is created,
      the following read/write properties are set to initial values.

      <list type="table">
        <listheader>
          <term>Properties</term>
          <term>Initial Value</term>
        </listheader>
        <item>
          <term>
            <see cref="CommandText"/>
          </term>
          <term>
            <i>cmdText</i>
          </term>
        </item>
        <item>
          <term>
            <see cref="CommandTimeout"/>
          </term>
          <term>0</term>
        </item>
        <item>
          <term>
            <see cref="CommandType"/>
          </term>
          <term>CommandType.Text</term>
        </item>
        <item>
          <term>
            <see cref="Connection"/>
          </term>
          <term>
            <i>connection</i>
          </term>
        </item>
      </list>
      <para>
        You can change the value for any of these properties through a separate call to
        the property.
      </para>
    </remarks>
    <example>
      The following example creates a <see cref="MySqlCommand"/> and
      sets some of its properties.

      <code lang="vbnet">
        Public Sub CreateMySqlCommand()
          Dim conn as new MySqlConnection("server=myServer")
          Dim sql as String = "SELECT * FROM mytable"
          Dim myCommand As New MySqlCommand(sql, conn)
          myCommand.CommandType = CommandType.Text
        End Sub
      </code>
      <code lang="C#">
        public void CreateMySqlCommand()
        {
          MySqlConnection conn = new MySqlConnection("server=myserver")
          string sql = "SELECT * FROM mytable";
          MySqlCommand myCommand = new MySqlCommand(sql, conn);
          myCommand.CommandType = CommandType.Text;
        }
      </code>
    </example>


  </ctor3>

  <ctor4>
    <summary>
      Initializes a new instance of the <see cref="MySqlCommand"/> class
      with the text of the query, a <see cref="MySqlConnection"/>, and the
      <see cref="MySqlTransaction"/>.
    </summary>

    <param name="cmdText">The text of the query.</param>
    <param name="connection">
      A <see cref="MySqlConnection"/> that represents the
      connection to an instance of SQL Server.
    </param>
    <param name="transaction">
      The <see cref="MySqlTransaction"/> in which the <see cref="MySqlCommand"/> executes.
    </param>
    <remarks>
      When an instance of <see cref="MySqlCommand"/> is created,
      the following read/write properties are set to initial values.

      <list type="table">
        <listheader>
          <term>Properties</term>
          <term>Initial Value</term>
        </listheader>
        <item>
          <term>
            <see cref="CommandText"/>
          </term>
          <term>
            <i>cmdText</i>
          </term>
        </item>
        <item>
          <term>
            <see cref="CommandTimeout"/>
          </term>
          <term>0</term>
        </item>
        <item>
          <term>
            <see cref="CommandType"/>
          </term>
          <term>CommandType.Text</term>
        </item>
        <item>
          <term>
            <see cref="Connection"/>
          </term>
          <term>
            <i>connection</i>
          </term>
        </item>
      </list>
      <para>
        You can change the value for any of these properties through a separate call to
        the property.
      </para>
    </remarks>
    <example>
      The following example creates a <see cref="MySqlCommand"/> and
      sets some of its properties.

      <code lang="vbnet">
        Public Sub CreateMySqlCommand()
          Dim conn as new MySqlConnection("server=myServer")
          conn.Open();
          Dim txn as MySqlTransaction = conn.BeginTransaction()
          Dim sql as String = "SELECT * FROM mytable"
          Dim myCommand As New MySqlCommand(sql, conn, txn)
          myCommand.CommandType = CommandType.Text
        End Sub
      </code>
      <code lang="C#">
        public void CreateMySqlCommand()
        {
          MySqlConnection conn = new MySqlConnection("server=myserver")
          conn.Open();
          MySqlTransaction txn = conn.BeginTransaction();
          string sql = "SELECT * FROM mytable";
          MySqlCommand myCommand = new MySqlCommand(sql, conn, txn);
          myCommand.CommandType = CommandType.Text;
        }
      </code>
    </example>

  </ctor4>

  <ExecuteNonQuery>
    <summary>
      Executes a SQL statement against the connection and returns the number of rows affected.
    </summary>
    <returns>Number of rows affected</returns>
    <remarks>
      You can use ExecuteNonQuery to perform any type of database operation,
      however any resultsets returned will not be available.  Any output parameters
      used in calling a stored procedure will be populated with data and can be
      retrieved after execution is complete.
      For UPDATE, INSERT, and DELETE statements, the return value is the number
      of rows affected by the command.  For all other types of statements, the return
      value is -1.
    </remarks>
    <example>
      The following example creates a MySqlCommand and then
      executes it using ExecuteNonQuery. The example is passed a string that is a
      SQL statement (such as UPDATE, INSERT, or DELETE) and a string to use to
      connect to the data source.
      <code lang="vbnet">
        Public Sub CreateMySqlCommand(myExecuteQuery As String, myConnection As MySqlConnection)
          Dim myCommand As New MySqlCommand(myExecuteQuery, myConnection)
          myCommand.Connection.Open()
          myCommand.ExecuteNonQuery()
          myConnection.Close()
        End Sub
      </code>
      <code lang="C#">
        public void CreateMySqlCommand(string myExecuteQuery, MySqlConnection myConnection)
        {
          MySqlCommand myCommand = new MySqlCommand(myExecuteQuery, myConnection);
          myCommand.Connection.Open();
          myCommand.ExecuteNonQuery();
          myConnection.Close();
        }
      </code>
    </example>
  </ExecuteNonQuery>

  <ExecuteReader1>
    <summary>
      Sends the <see cref="CommandText"/> to the <see cref="MySqlConnection">Connection</see>,
      and builds a <see cref="MySqlDataReader"/> using one of the <see cref="CommandBehavior"/> values.
    </summary>
    <param name="behavior">
      One of the <see cref="CommandBehavior"/> values.
    </param>
    <remarks>
      <para>
        When the <see cref="CommandType"/> property is set to <b>StoredProcedure</b>,
        the <see cref="CommandText"/> property should be set to the name of the stored
        procedure. The command executes this stored procedure when you call
        <b>ExecuteReader</b>.
      </para>
      <para>
        The <see cref="MySqlDataReader"/> supports a special mode that enables large binary
        values to be read efficiently. For more information, see the <b>SequentialAccess</b>
        setting for <see cref="CommandBehavior"/>.
      </para>
      <para>
        While <see cref="MySqlDataReader"/> is in use, the associated
        instance of <see cref="MySqlConnection"/> is busy serving it
        and no other operations can be performed on <see cref="MySqlConnection"/>, other than closing it.
        This is the case until the <see cref="MySqlDataReader.Close"/> method of the <b>MySqlDataReader</b> is called.
        If the <b>MySqlDataReader</b> object is created with <b>CommandBehavior</b> set to
        <b>CloseConnection</b>, closing the <b>MySqlDataReader</b> instance closes the connection
        automatically.
      </para>
      <note>
        When calling ExecuteReader with the SingleRow behavior, you should be aware that using a <i>limit</i>
        clause in your SQL will cause all rows (up to the limit given) to be retrieved by the client.  The
        <see cref="MySqlDataReader.Read"/> method will still return false after the first row but pulling all rows of data
        into the client will have a performance impact.  If the <i>limit</i> clause is not necessary, it should
        be avoided.
      </note>
    </remarks>
    <returns>
      A <see cref="MySqlDataReader"/> object.
    </returns>
  </ExecuteReader1>

  <ExecuteReader>
    <summary>
      Sends the <see cref="CommandText"/> value to <see cref="MySqlConnection"/>
      and builds a <see cref="MySqlDataReader"/> object.
    </summary>
    <returns>
      A <see cref="MySqlDataReader"/> object.
    </returns>
    <remarks>
      <para>
        When the <see cref="CommandType"/> property is set to <b>StoredProcedure</b>,
        the <see cref="CommandText"/> property should be set to the name of the stored
        procedure. The command executes this stored procedure when you call
        <b>ExecuteReader</b>.
      </para>
      <para>
        While <see cref="MySqlDataReader"/> is in use, the associated
        instance of <see cref="MySqlConnection"/> is busy serving it
        and no other operations can be performed on <see cref="MySqlConnection"/>, other than closing it.
        This is the case until the <see cref="MySqlDataReader.Close"/> method of <b>MySqlDataReader</b> is called.
      </para>
    </remarks>
    <example>
      The following example creates an instance of <see cref="MySqlCommand"/>, then executes it by
      passing a string that is a SQL SELECT statement, and a string to use to connect to the
      data source.
      <code lang="vbnet">
        Public Sub CreateMySqlDataReader(mySelectQuery As String, myConnection As MySqlConnection)
          Dim myCommand As New MySqlCommand(mySelectQuery, myConnection)
          myConnection.Open()
          Dim myReader As MySqlDataReader
          myReader = myCommand.ExecuteReader()
          
          Try
            While myReader.Read()
            Console.WriteLine(myReader.GetString(0))
            End While
            Finally
            myReader.Close
            myConnection.Close
          End Try
        End Sub
      </code>
      <code lang="C#">
        public void CreateMySqlDataReader(string mySelectQuery, MySqlConnection myConnection)
        {
          MySqlCommand myCommand = new MySqlCommand(mySelectQuery, myConnection);
          myConnection.Open();
          MMySqlDataReader myReader;
          myReader = myCommand.ExecuteReader();
          try
          {
            while(myReader.Read())
            {
              Console.WriteLine(myReader.GetString(0));
            }
          }
          finally
          {
            myReader.Close();
            myConnection.Close();
          }
        }
      </code>
    </example>
  </ExecuteReader>

  <Prepare>
    <summary>
      Creates a prepared version of the command on an instance of MySQL Server.
    </summary>
    <remarks>
      <para>
        Prepared statements are only supported on MySQL version 4.1 and higher.  Calling
        prepare while connected to earlier versions of MySQL will succeed but will execute
        the statement in the same way as unprepared.
      </para>
    </remarks>
    <example>
      The following example demonstrates the use of the <b>Prepare</b> method.
      <code lang="VB.NET">
        public sub PrepareExample()
          Dim cmd as New MySqlCommand("INSERT INTO mytable VALUES (@val)", myConnection)
          cmd.Parameters.Add( "@val", 10 )
          cmd.Prepare()
          cmd.ExecuteNonQuery()

          cmd.Parameters(0).Value = 20
          cmd.ExecuteNonQuery()
        end sub
      </code>
      <code lang="C#">
        private void PrepareExample()
        {
          MySqlCommand cmd = new MySqlCommand("INSERT INTO mytable VALUES (@val)", myConnection);
          cmd.Parameters.Add( "@val", 10 );
          cmd.Prepare();
          cmd.ExecuteNonQuery();

          cmd.Parameters[0].Value = 20;
          cmd.ExecuteNonQuery();
        }
      </code>
    </example>
  </Prepare>

  <ExecuteScalar>
    <summary>
      Executes the query, and returns the first column of the first row in the
      result set returned by the query. Extra columns or rows are ignored.
    </summary>
    <returns>
      The first column of the first row in the result set, or a null reference if the
      result set is empty
    </returns>
    <remarks>
      <para>
        Use the <b>ExecuteScalar</b> method to retrieve a single value (for example,
        an aggregate value) from a database. This requires less code than using the
        <see cref="ExecuteReader()"/> method, and then performing the operations necessary
        to generate the single value using the data returned by a <see cref="MySqlDataReader"/>
      </para>
    </remarks>
    <example>
      The following example creates a <see cref="MySqlCommand"/> and then
      executes it using <b>ExecuteScalar</b>. The example is passed a string that is a
      SQL statement that returns an aggregate result, and a string to use to
      connect to the data source.

      <code lang="vbnet">
        Public Sub CreateMySqlCommand(myScalarQuery As String, myConnection As MySqlConnection)
          Dim myCommand As New MySqlCommand(myScalarQuery, myConnection)
          myCommand.Connection.Open()
          myCommand.ExecuteScalar()
          myConnection.Close()
        End Sub
      </code>
      <code lang="C#">
        public void CreateMySqlCommand(string myScalarQuery, MySqlConnection myConnection)
        {
          MySqlCommand myCommand = new MySqlCommand(myScalarQuery, myConnection);
          myCommand.Connection.Open();
          myCommand.ExecuteScalar();
          myConnection.Close();
        }
      </code>
    </example>
  </ExecuteScalar>

  <CommandText>
    <summary>
      Gets or sets the SQL statement to execute at the data source.
    </summary>
    <value>
      The SQL statement or stored procedure to execute. The default is an empty string.
    </value>
    <remarks>
      <para>
        When the <see cref="CommandType"/> property is set to <see cref="System.Data.CommandType.StoredProcedure"/>,
        the <see cref="CommandText"/> property should be set to the name of the stored procedure.
        The user may be required to use escape character syntax if the stored procedure name
        contains any special characters. The command executes this stored procedure when
        you call one of the execute methods. In Connector/NET 8.0 (and previous versions), having both a stored function
        and stored procedure with the same name in the same database is not supported. It is
        suggested that you provide unqiue names for your stored routines.
      </para>
    </remarks>
    <example>
      The following example creates an instance of <see cref="MySqlCommand"/> and sets some of its properties.
      <code lang="vbnet">
        Public Sub CreateMySqlCommand()
          Dim myCommand As New MySqlCommand()
          myCommand.CommandText = "SELECT * FROM Mytable ORDER BY id"
          myCommand.CommandType = CommandType.Text
        End Sub
      </code>
      <code lang="C#">
        public void CreateMySqlCommand()
        {
          MySqlCommand myCommand = new MySqlCommand();
          myCommand.CommandText = "SELECT * FROM mytable ORDER BY id";
          myCommand.CommandType = CommandType.Text;
        }
      </code>
    </example>
  </CommandText>

  <CommandTimeout>
    <summary>
      Gets or sets the wait time before terminating the attempt to execute a command
      and generating an error.
    </summary>
    <value>
      The time (in seconds) to wait for the command to execute. The default is 30
      seconds.
    </value>
    <remarks>
      CommandTimeout is dependent on the ability of MySQL to cancel an executing query.
      Because of this, CommandTimeout is only supported when connected to MySQL
      version 5.0.0 or higher.
    </remarks>
  </CommandTimeout>

  <CommandType>
    <summary>
      Gets or sets a value indicating how the <see cref="CommandText"/> property is to be interpreted.
    </summary>
    <value>
      One of the <see cref="System.Data.CommandType"/> values. 
      The default is <see cref="System.Data.CommandType.Text"/>.
    </value>
    <remarks>
      <para>
        When you set the <see cref="CommandType"/> property to <see cref="System.Data.CommandType.StoredProcedure"/>, you
        should set the <see cref="CommandText"/> property to the name of the stored
        procedure. The command executes this stored procedure when you call one of the
        execute methods.
      </para>
    </remarks>
    <example>
      The following example creates an instance of <see cref="MySqlCommand"/> and sets some of its properties.
      <code lang="vbnet">
        Public Sub CreateMySqlCommand()
          Dim myCommand As New MySqlCommand()
          myCommand.CommandType = CommandType.Text
        End Sub
      </code>
      <code lang="C#">
        public void CreateMySqlCommand()
        {
          MySqlCommand myCommand = new MySqlCommand();
          myCommand.CommandType = CommandType.Text;
        }
      </code>
    </example>
  </CommandType>

  <Connection>
    <summary>
      Gets or sets the <see cref="MySqlConnection"/> object used by this instance of the
      <see cref="MySqlCommand"/>.
    </summary>
    <value>
      The connection to a data source. The default value is a null reference
      (<b>Nothing</b> in Visual Basic).
    </value>
    <remarks>
      <para>
        If you set <b>Connection</b> while a transaction is in progress and the
        <see cref="Transaction"/> property is not null, an <see cref="InvalidOperationException"/>
        is generated. If the <b>Transaction</b> property is not null and the transaction
        has already been committed or rolled back, <b>Transaction</b> is set to
        null.
      </para>
    </remarks>
    <example>
      The following example creates a <see cref="MySqlCommand"/> and sets some of its properties.
      <code lang="vbnet">
        Public Sub CreateMySqlCommand()
          Dim mySelectQuery As String = "SELECT * FROM mytable ORDER BY id"
          Dim myConnectString As String = "Persist Security Info=False;database=test;server=myServer"
          Dim myCommand As New MySqlCommand(mySelectQuery)
          myCommand.Connection = New MySqlConnection(myConnectString)
          myCommand.CommandType = CommandType.Text
        End Sub
      </code>
      <code lang="C#">
        public void CreateMySqlCommand()
        {
          string mySelectQuery = "SELECT * FROM mytable ORDER BY id";
          string myConnectString = "Persist Security Info=False;database=test;server=myServer";
          MySqlCommand myCommand = new MySqlCommand(mySelectQuery);
          myCommand.Connection = new MySqlConnection(myConnectString);
          myCommand.CommandType = CommandType.Text;
        }
      </code>
    </example>
  </Connection>

  <LastInsertedId>
    <summary>Provides the ID of the last inserted row.</summary>
    <value>
      ID of the last inserted row.  -1 if none exists.
    </value>
    <remarks>
      An important point to remember is that this property can be used
      in batch SQL scenarios but it's important to remember that it will
      only reflect the insert id from the last insert statement in the batch.

      This property can also be used when the batch includes select statements
      and ExecuteReader is used.  This property can be consulted during result set
      processing.
    </remarks>
  </LastInsertedId>

  <Parameters>
    <summary>
      Gets the <see cref="MySqlParameterCollection"/> object.
    </summary>
    <value>
      The parameters of the SQL statement or stored procedure. The default is
      an empty collection.
    </value>
    <remarks>
      Connector/NET does not support unnamed parameters.  Every parameter added to the collection must
      have an associated name.
      
      <note>Parameters can be used along with <see cref="MySqlAttribute"/>. There are no restrictions in this regard.</note>
    </remarks>
    <example>
      The following example creates an instance of <see cref="MySqlCommand"/> and displays its parameters.
      To accomplish this, the method is passed a <see cref="MySqlConnection"/>, a query string
      that is a SQL SELECT statement, and an array of <see cref="MySqlParameter"/> objects.
      <code lang="vbnet">
        Public Sub CreateMySqlCommand(myConnection As MySqlConnection, _
          mySelectQuery As String, myParamArray() As MySqlParameter)
            Dim myCommand As New MySqlCommand(mySelectQuery, myConnection)
            myCommand.CommandText = "SELECT id, name FROM mytable WHERE age=@age"
            myCommand.UpdatedRowSource = UpdateRowSource.Both
            myCommand.Parameters.Add(myParamArray)
            Dim j As Integer
            For j = 0 To myCommand.Parameters.Count - 1
              myCommand.Parameters.Add(myParamArray(j))
            Next j
            Dim myMessage As String = ""
            Dim i As Integer
            For i = 0 To myCommand.Parameters.Count - 1
              myMessage += myCommand.Parameters(i).ToString() &amp; ControlChars.Cr
            Next i
            Console.WriteLine(myMessage)
        End Sub
      </code>
      <code lang="C#">
        public void CreateMySqlCommand(MySqlConnection myConnection, string mySelectQuery,
          MySqlParameter[] myParamArray)
        {
          MySqlCommand myCommand = new MySqlCommand(mySelectQuery, myConnection);
          myCommand.CommandText = "SELECT id, name FROM mytable WHERE age=@age";
          myCommand.Parameters.Add(myParamArray);
          for (int j=0; j&lt;myParamArray.Length; j++)
          {
            myCommand.Parameters.Add(myParamArray[j]) ;
          }
          string myMessage = "";
          for (int i = 0; i &lt; myCommand.Parameters.Count; i++)
          {
            myMessage += myCommand.Parameters[i].ToString() + "\n";
          }
          MessageBox.Show(myMessage);
        }
      </code>
    </example>
  </Parameters>

  <Attributes>
    <summary>
      Gets the <see cref="MySqlAttributeCollection"/> object.
    </summary>
    <value>
      The query attributes defined for the statement. The default is an empty collection.
    </value>
    <remarks>
      Connector/NET does not support unnamed query attributes. Every query attribute added to the collection must
      have an associated name.
      
      <note>Query Attributes can be used along with <see cref="MySqlParameter"/>. There are no restrictions in this regard.</note>
    </remarks>
    <example>
      The following example creates an instance of <see cref="MySqlCommand"/> and also a couple of <see cref="MySqlAttribute"/>
      to be added later to the <see cref="MySqlCommand"/>. Then, it prints out the values of <see cref="MySqlAttribute"/>.
      <code lang="vbnet">
        Public Sub CreateMySqlCommandWithQueryAttributes(ByVal myConnection As MySqlConnection)
          Dim myCommand As MySqlCommand = New MySqlCommand()
          myCommand.Connection = myConnection
          Dim mySqlAttribute As MySqlAttribute = New MySqlAttribute("qa1", "qaValue")
          Dim mySqlAttribute2 As MySqlAttribute = New MySqlAttribute("qa2", 2)
          myCommand.Attributes.SetAttribute(mySqlAttribute)
          myCommand.Attributes.SetAttribute(mySqlAttribute2)
          myCommand.CommandText = $"SELECT mysql_query_attribute_string('{mySqlAttribute.AttributeName}') AS attr1," &amp; 
            $"mysql_query_attribute_string('{mySqlAttribute2.AttributeName}') AS attr2"

          Using reader = myCommand.ExecuteReader()
            While reader.Read()
              Console.WriteLine($"Attribute1 Value: {reader.GetString(0)}")
              Console.WriteLine($"Attribute1 Value: {reader.GetString(1)}")
            End While
          End Using
        End Sub
      </code>
      <code lang="C#">
        public void CreateMySqlCommandWithQueryAttributes(MySqlConnection myConnection)
        {
          MySqlCommand myCommand = new MySqlCommand();
          myCommand.Connection = myConnection;

          MySqlAttribute mySqlAttribute = new MySqlAttribute("qa1", "qaValue");
          MySqlAttribute mySqlAttribute2 = new MySqlAttribute("qa2", 2);

          myCommand.Attributes.SetAttribute(mySqlAttribute);
          myCommand.Attributes.SetAttribute(mySqlAttribute2);

          myCommand.CommandText = $"SELECT mysql_query_attribute_string('{mySqlAttribute.AttributeName}') AS attr1," +
            $"mysql_query_attribute_string('{mySqlAttribute2.AttributeName}') AS attr2";

          using (var reader = myCommand.ExecuteReader())
          {
            while (reader.Read())
            {
              Console.WriteLine($"Attribute1 Value: {reader.GetString(0)}");
              Console.WriteLine($"Attribute1 Value: {reader.GetString(1)}");
            }
          }
        }
      </code>
    </example>
  </Attributes>
    
  <Transaction>
    <summary>
      Gets or sets the instance of <see cref="MySqlTransaction"/> within which <see cref="MySqlCommand"/> executes.
    </summary>
    <value>
      The <see cref="MySqlTransaction"/>.  The default value is a null reference (<b>Nothing</b> in Visual Basic).
    </value>
    <remarks>
      You cannot set the <b>Transaction</b> property if it is already set to a
      specific value, and the command is in the process of executing. If you set the
      transaction to use a <see cref="MySqlTransaction"/> object that is not connected
      to the same <see cref="MySqlConnection"/> as the <see cref="MySqlCommand"/> object,
      an exception will be thrown the next time you attempt to execute a statement.
    </remarks>
  </Transaction>

  <UpdatedRowSource>
    <summary>
      Gets or sets how command results are applied to the <see cref="DataRow"/>
      when used by the <see cref="System.Data.Common.DbDataAdapter.Update"/> method
      of the <see cref="System.Data.Common.DbDataAdapter"/>.
    </summary>
    <value>
      One of the <see cref="UpdateRowSource"/> values.
    </value>
    <remarks>
      <para>
        The default <see cref="System.Data.UpdateRowSource"/> value is
        <b>Both</b> unless the command is automatically generated (as in the case of the
        <see cref="MySqlCommandBuilder"/>), in which case the default is <b>None</b>.
      </para>
    </remarks>
  </UpdatedRowSource>

</docs>
