title: Problem with MySQL's LAST_INSERT_ID()
body: <p>I am having a problem with <code>LAST_INSERT_ID()</code>.</p>
  
  <p>Every time I use it I need to open and close a new connection. 
  This slows down my application a great deal.
  i need to do many insert statements end get for each one his inserted id
  all on the same connection!
  How can I get the last inserted ID on the same connection
  for with MySQl, ODBC and C# from a specific table with no concurrency problems?</p>
  
  <p>here is my code:</p>
  
  <pre><code>#region Private Variables
  private static DataAccess _DataAccess = null;
  private static object _SyncLock = new object();
  private OdbcConnection myConnection = null;
  #endregion
  
  #region Instance Method
  public static DataAccess Instance
  {
      get
      {
          lock (_SyncLock)
          {
              if (_DataAccess == null)
                  _DataAccess = new DataAccess();
              return _DataAccess;
          }
      }
  }
  #endregion
  
  #region Constractors
  public DataAccess()
  {
      myConnection = new OdbcConnection(stringConnDB);
      myConnection.Open();
  }
  #endregion
  </code></pre>