public override bool NextResult()
        {
            bool flag;
            SqlStatistics statistics = null;
            IntPtr ptr;
            Bid.ScopeEnter(out ptr, "<sc.SqlDataReader.NextResult|API> %d#", this.ObjectID);
            RuntimeHelpers.PrepareConstrainedRegions();
            try
            {
                statistics = SqlStatistics.StartTimer(this.Statistics);
                this.SetTimeout();
                if (this.IsClosed)
                {
                    throw ADP.DataReaderClosed("NextResult");
                }
                this._fieldNameLookup = null;
                bool flag2 = false;
                this._hasRows = false;
                if (this.IsCommandBehavior(CommandBehavior.SingleResult))
                {
                    this.CloseInternal(false);
                    this.ClearMetaData();
                    return flag2;
                }
                if (this._parser != null)
                {
                    while (this.ReadInternal(false))
                    {
                    }
                }
                if (this._parser != null)
                {
                    if (this.HasMoreResults())
                    {
                        this._metaDataConsumed = false;
                        this._browseModeInfoConsumed = false;
                        switch (this._altRowStatus)
                        {
                            case ALTROWSTATUS.AltRow:
                            {
                                int altRowId = this._parser.GetAltRowId(this._stateObj);
                                _SqlMetaDataSet altMetaData = this._altMetaDataSetCollection.GetAltMetaData(altRowId);
                                if (altMetaData != null)
                                {
                                    this._metaData = altMetaData;
                                    this._metaData.indexMap = altMetaData.indexMap;
                                }
                                break;
                            }
                            case ALTROWSTATUS.Done:
                                this._metaData = this._altMetaDataSetCollection.metaDataSet;
                                this._altRowStatus = ALTROWSTATUS.Null;
                                break;

                            default:
                                this.ConsumeMetaData();
                                if (this._metaData == null)
                                {
                                    return false;
                                }
                                break;
                        }
                        return true;
                    }
                    this.CloseInternal(false);
                    this.SetMetaData(null, false);
                    return flag2;
                }
                this.ClearMetaData();
                return flag2;
            }
            catch (OutOfMemoryException exception3)
            {
                this._isClosed = true;
                if (this._connection != null)
                {
                    this._connection.Abort(exception3);
                }
                throw;
            }
            catch (StackOverflowException exception2)
            {
                this._isClosed = true;
                if (this._connection != null)
                {
                    this._connection.Abort(exception2);
                }
                throw;
            }
            catch (ThreadAbortException exception)
            {
                this._isClosed = true;
                if (this._connection != null)
                {
                    this._connection.Abort(exception);
                }
                throw;
            }
            finally
            {
                SqlStatistics.StopTimer(statistics);
                Bid.ScopeLeave(ref ptr);
            }
            return flag;
        }
 private bool ReadInternal(bool setTimeout)
 {
     bool flag;
     SqlStatistics statistics = null;
     IntPtr ptr;
     Bid.ScopeEnter(out ptr, "<sc.SqlDataReader.Read|API> %d#", this.ObjectID);
     RuntimeHelpers.PrepareConstrainedRegions();
     try
     {
         statistics = SqlStatistics.StartTimer(this.Statistics);
         if (this._parser == null)
         {
             goto Label_017B;
         }
         if (setTimeout)
         {
             this.SetTimeout();
         }
         if (this._dataReady)
         {
             this.CleanPartialRead();
         }
         this._dataReady = false;
         SqlBuffer.Clear(this._data);
         this._nextColumnHeaderToRead = 0;
         this._nextColumnDataToRead = 0;
         this._columnDataBytesRemaining = -1L;
         if (this._haltRead)
         {
             goto Label_016A;
         }
         if (this.HasMoreRows())
         {
             while (this._stateObj._pendingData)
             {
                 if (this._altRowStatus != ALTROWSTATUS.AltRow)
                 {
                     this._dataReady = this._parser.Run(RunBehavior.ReturnImmediately, this._command, this, null, this._stateObj);
                     if (!this._dataReady)
                     {
                         continue;
                     }
                 }
                 else
                 {
                     this._altRowStatus = ALTROWSTATUS.Done;
                     this._dataReady = true;
                 }
                 break;
             }
             if (this._dataReady)
             {
                 this._haltRead = this.IsCommandBehavior(CommandBehavior.SingleRow);
                 return true;
             }
         }
         if (!this._stateObj._pendingData)
         {
             this.CloseInternal(false);
         }
         goto Label_018E;
     Label_010E:
         this._dataReady = this._parser.Run(RunBehavior.ReturnImmediately, this._command, this, null, this._stateObj);
     Label_012E:
         if (this._stateObj._pendingData && !this._dataReady)
         {
             goto Label_010E;
         }
         if (this._dataReady)
         {
             this.CleanPartialRead();
         }
         this._dataReady = false;
         SqlBuffer.Clear(this._data);
         this._nextColumnHeaderToRead = 0;
     Label_016A:
         if (this.HasMoreRows())
         {
             goto Label_012E;
         }
         this._haltRead = false;
         goto Label_018E;
     Label_017B:
         if (this.IsClosed)
         {
             throw ADP.DataReaderClosed("Read");
         }
     Label_018E:
         return false;
     }
     catch (OutOfMemoryException exception3)
     {
         this._isClosed = true;
         SqlConnection connection3 = this._connection;
         if (connection3 != null)
         {
             connection3.Abort(exception3);
         }
         throw;
     }
     catch (StackOverflowException exception2)
     {
         this._isClosed = true;
         SqlConnection connection2 = this._connection;
         if (connection2 != null)
         {
             connection2.Abort(exception2);
         }
         throw;
     }
     catch (ThreadAbortException exception)
     {
         this._isClosed = true;
         SqlConnection connection = this._connection;
         if (connection != null)
         {
             connection.Abort(exception);
         }
         throw;
     }
     finally
     {
         SqlStatistics.StopTimer(statistics);
         Bid.ScopeLeave(ref ptr);
     }
     return flag;
 }
        private bool HasMoreResults()
        {
            if (this._parser != null)
            {
                if (!this.HasMoreRows())
                {
                    while (this._stateObj._pendingData)
                    {
                        switch (this._stateObj.PeekByte())
                        {
                            case 0xd1:
                                return true;

                            case 0xd3:
                                if (this._altRowStatus == ALTROWSTATUS.Null)
                                {
                                    this._altMetaDataSetCollection.metaDataSet = this._metaData;
                                    this._metaData = null;
                                }
                                this._altRowStatus = ALTROWSTATUS.AltRow;
                                this._hasRows = true;
                                return true;

                            case 0xfd:
                                this._altRowStatus = ALTROWSTATUS.Null;
                                this._metaData = null;
                                this._altMetaDataSetCollection = null;
                                return true;

                            case 0x81:
                                return true;
                        }
                        this._parser.Run(RunBehavior.ReturnImmediately, this._command, this, null, this._stateObj);
                    }
                }
                else
                {
                    return true;
                }
            }
            return false;
        }