Beispiel #1
0
        private static void QueryAsyncCallback(IAsyncResult iAr)
        {
            QueryObject <bool> qo = (QueryObject <bool>)iAr.AsyncState;

            try
            {
                MySqlConnection c = null;
                using (MySqlCommand cmd = qo.MySQLCommand)
                {
                    cmd.EndExecuteNonQuery(iAr);
                    c = cmd.Connection;
                }

                if (c != null)
                {
                    c.Dispose();
                }
                if (qo.OriginalCallback != null)
                {
                    qo.OriginalCallback(true);
                }
            }
            catch
            {
                if (qo.OriginalCallback != null)
                {
                    qo.OriginalCallback(false);
                }
            }
        }
Beispiel #2
0
        private static void QueryAsyncCallback(IAsyncResult iAr)
        {
            QueryObject <bool> qo = (QueryObject <bool>)iAr.AsyncState;

            try
            {
                MySqlConnection c = null;
                using (MySqlCommand cmd = qo.MySQLCommand)
                {
                    cmd.CommandTimeout = 0; // No timeout
                    cmd.EndExecuteNonQuery(iAr);
                    c = cmd.Connection;
                }

                if (c != null)
                {
                    c.Dispose();
                }
                if (qo.OriginalCallback != null)
                {
                    qo.OriginalCallback(true);
                }
            }
            catch (Exception ex)
            {
                if (qo.OriginalCallback != null)
                {
                    qo.OriginalCallback(false);
                }
                Log.WriteError("Error while executing query: " + ex.Message);
            }
        }