title: C#, MySQL, ADO.NET, delimiter causing syntax error
body: <p>I have C# code that cycles through <code>.sql</code> files and executes what's inside them to set up a database.</p>
  
  <p>One <code>.sql</code> file is basically as follows:</p>
  
  <pre><code>DROP PROCEDURE IF EXISTS myProc;
  
  DELIMITER $$
  
  CREATE PROCEDURE myProc()
  BEGIN
  -- procedure stuff goes here
  END $$
  
  DELIMITER ;
  
  CALL myProc();
  </code></pre>
  
  <p>When I input this into the MySQL Query Browser's script window, it runs perfectly... over and over again, just as one would want it to.</p>
  
  <p>However, if I put the string into my <code>IDbCommand</code> and execute it...</p>
  
  <pre><code>connection.Open(); // An IDbConnection
  IDbTransaction transaction = connection.BeginTransaction();
  using (IDbCommand cmd = connection.CreateCommand())
  {
      cmd.Connection = connection;
      cmd.Transaction = transaction;
      cmd.CommandText = line;
      cmd.CommandType = CommandType.Text;
  
      try
      {
          cmd.ExecuteNonQuery();
      }
      catch (SqlException ex)
      {
          transaction.Rollback();
          return false;
      }
  }
  
  transaction.Commit();
  connection.Close();
  </code></pre>
  
  <p>... I get the dreaded exception 1064...</p>
  
  <blockquote>
    <p>You have an error in your SQL syntax; check the manual that
    corresponds to your MySQL server version for the right syntax to use
    near 'DELIMITER $$ CREATE PROCEDURE myProc() BEGIN...</p>
  </blockquote>
  
  <p>So, the question is... why does MySQL let me do this with no problems, but when I try to run it from C#, it fails? And of course the second question is how I'm supposed to fix it.</p>