title: MySql statement prepare "not sticking"
body: <p>I'm attempting to use a prepared statement, and while the MySqlCommand executes just fine, the execution time is abysmal.  I had it write the result of cmd.IsPrepared to the console, and sure enough, it is false.  Here is where I setup the MySqlCommand:</p>
  
  <pre><code>MySqlCommand cmd = con.CreateCommand();
  cmd.CommandText = @"INSERT INTO dict (pre, dist, dict.char, score) VALUES(@pre, @dist, @char, @score) ON DUPLICATE KEY UPDATE score = score + @score";
  cmd.Parameters.Add("@pre", MySqlDbType.VarChar, 32);
  cmd.Parameters.Add("@dist", MySqlDbType.Int32);
  cmd.Parameters.Add("@char", MySqlDbType.VarChar, 1);
  cmd.Parameters.Add("@score", MySqlDbType.Double);
  cmd.Prepare();
  </code></pre>
  
  <p>I've also tried executing the Prepare() before adding parameters with the same result.</p>
  
  <p>I then have a loop of code that does some computation and sets variables like so:</p>
  
  <pre><code>cmd.Parameters[3].Value = score;
  </code></pre>
  
  <p>...and does nothing else to the command until it comes time to run:</p>
  
  <pre><code>Console.WriteLine(cmd.IsPrepared);
  cmd.ExecuteNonQuery();
  </code></pre>
  
  <p>The result to the console is always false.  This is all done within a basic transaction, but that doesn't seem like it should mess things up.  I do open the transaction before I setup the MySqlCommand, though.</p>
  
  <p>Any ideas as to where this is going wrong?</p>
  
  <p>edit: I replicated the code in java, and the prepared statements work fine in it.  So it's not a problem with my database server itself, it is specifically a problem in .net.  Surely the .net/connector isn't broken for everyone, so what could possibly be the deal here?</p>
  
  <p>And it definitely isn't prepared and simply not setting that bool value, the running time in .net for some test input is so long I don't have the patience to wait it out, but in java the same input runs in ~3 minutes.  Both use basically the same code.</p>
  
  <p>Here's a simple test I did in .net, so you can see the full code of what I'm trying (I removed the UID and password from the connection string, but in the normal code they are there, a connection is established, and the statement enters data into the database):</p>
  
  <pre><code>        using (MySqlConnection con = new MySqlConnection(@"SERVER=localhost;DATABASE=rb;UID=;PASSWORD=;"))
          {
              con.Open();
  
              using (MySqlCommand cmd = con.CreateCommand())
              {
                  cmd.CommandText = @"INSERT INTO test (test.test) VALUES(?asdf)";
                  cmd.Prepare(); //doesn't work
  
                  cmd.Parameters.AddWithValue("?asdf", 1);
  
                  cmd.ExecuteNonQuery();
              }
          }
  </code></pre>
  
  <p>I'm using MySql.Data.dll version 6.4.4.0 with a runtime version of v4.0.30319 in c# 2010.  I'm also including MySql.Data.MySqlClient for the above example code.</p>