title: How do multi rows insert with MySqlCommand and prepare statement?(#C)
body: <p>Mysql give example how insert rows with prepare statement and .NET:
  <a href="http://dev.mysql.com/doc/refman/5.5/en/connector-net-programming-prepared.html" rel="nofollow">http://dev.mysql.com/doc/refman/5.5/en/connector-net-programming-prepared.html</a></p>
  
  <p>Its looks that its works like that,because in the end of each iteration call to:<code>cmd.ExecuteNonQuery()</code>:</p>
  
  <pre><code>INSERT INTO VALUES()...;INSERT INTO VALUES()...;INSERT INTO VALUES()...;
  </code></pre>
  
  <p>Can it done with use of prepare statement like that:</p>
  
  <pre><code>INSERT INTO all values...
  </code></pre>
  
  <p><strong>More explanations::</strong></p>
  
  <hr>
  
  <p><strong>The code in mysql example (cmd.ExecuteNonQuery() in each iteration):</strong></p>
  
  <pre><code>MySql.Data.MySqlClient.MySqlConnection conn;
  MySql.Data.MySqlClient.MySqlCommand cmd;
  
  conn = new MySql.Data.MySqlClient.MySqlConnection();
  cmd = new MySql.Data.MySqlClient.MySqlCommand();
  
  conn.ConnectionString = strConnection;
  
  try
  {
      conn.Open();
      cmd.Connection = conn;
  
      cmd.CommandText = "INSERT INTO myTable VALUES(NULL, @number, @text)";
      cmd.Prepare();
  
      cmd.Parameters.AddWithValue("@number", 1);
      cmd.Parameters.AddWithValue("@text", "One");
  
      for (int i=1; i &lt;= 1000; i++)
      {
          cmd.Parameters["@number"].Value = i;
          cmd.Parameters["@text"].Value = "A string value";
  
          cmd.ExecuteNonQuery();
      }
  }
  </code></pre>
  
  <p>*<em>The code that i want to have like that(<code>cmd.ExecuteNonQuery();</code> after all iterations): *</em></p>
  
  <pre><code>MySql.Data.MySqlClient.MySqlConnection conn;
  MySql.Data.MySqlClient.MySqlCommand cmd;
  
  conn = new MySql.Data.MySqlClient.MySqlConnection();
  cmd = new MySql.Data.MySqlClient.MySqlCommand();
  
  conn.ConnectionString = strConnection;
  
  try
  {
      conn.Open();
      cmd.Connection = conn;
  
      cmd.CommandText = "INSERT INTO myTable VALUES(NULL, @number, @text)";
      cmd.Prepare();
  
      cmd.Parameters.AddWithValue("@number", 1);
      cmd.Parameters.AddWithValue("@text", "One");
  
      for (int i=1; i &lt;= 1000; i++)
      {
          cmd.Parameters["@number"].Value = i;
          cmd.Parameters["@text"].Value = "A string value";
  
  
      }
      cmd.ExecuteNonQuery();
  }
  </code></pre>