private int FillFromRecordset(object data, System.Data.Common.UnsafeNativeMethods.ADORecordsetConstruction recordset, string srcTable, out bool incrementResultCount)
        {
            IntPtr ptr;

            incrementResultCount = false;
            object result = null;

            try
            {
                Bid.Trace("<oledb.ADORecordsetConstruction.get_Rowset|API|ADODB>\n");
                result = recordset.get_Rowset();
                Bid.Trace("<oledb.ADORecordsetConstruction.get_Rowset|API|ADODB|RET> %08X{HRESULT}\n", 0);
                Bid.Trace("<oledb.ADORecordsetConstruction.get_Chapter|API|ADODB>\n");
                ptr = recordset.get_Chapter();
                Bid.Trace("<oledb.ADORecordsetConstruction.get_Chapter|API|ADODB|RET> %08X{HRESULT}\n", 0);
            }
            catch (Exception exception)
            {
                if (!ADP.IsCatchableExceptionType(exception))
                {
                    throw;
                }
                throw ODB.Fill_EmptyRecordSet("ADODBRecordSet", exception);
            }
            if (result != null)
            {
                CommandBehavior commandBehavior = (MissingSchemaAction.AddWithKey != base.MissingSchemaAction) ? CommandBehavior.Default : CommandBehavior.KeyInfo;
                commandBehavior |= CommandBehavior.SequentialAccess;
                OleDbDataReader dataReader = null;
                try
                {
                    ChapterHandle chapterHandle = ChapterHandle.CreateChapterHandle(ptr);
                    dataReader = new OleDbDataReader(null, null, 0, commandBehavior);
                    dataReader.InitializeIRowset(result, chapterHandle, ADP.RecordsUnaffected);
                    dataReader.BuildMetaInfo();
                    incrementResultCount = 0 < dataReader.FieldCount;
                    if (incrementResultCount)
                    {
                        if (data is DataTable)
                        {
                            return(base.Fill((DataTable)data, dataReader));
                        }
                        return(base.Fill((DataSet)data, srcTable, dataReader, 0, 0));
                    }
                }
                finally
                {
                    if (dataReader != null)
                    {
                        dataReader.Close();
                    }
                }
            }
            return(0);
        }
        private int FillFromADODB(object data, object adodb, string srcTable, bool multipleResults)
        {
            string sourceTableName;
            bool   flag2;
            bool   flag = multipleResults;

            Bid.Trace("<oledb.IUnknown.QueryInterface|API|OLEDB|ADODB> ADORecordsetConstruction\n");
            System.Data.Common.UnsafeNativeMethods.ADORecordsetConstruction recordset = adodb as System.Data.Common.UnsafeNativeMethods.ADORecordsetConstruction;
            System.Data.Common.UnsafeNativeMethods.ADORecordConstruction    record    = null;
            if (recordset != null)
            {
                if (multipleResults)
                {
                    Bid.Trace("<oledb.Recordset15.get_ActiveConnection|API|ADODB>\n");
                    if (((System.Data.Common.UnsafeNativeMethods.Recordset15)adodb).get_ActiveConnection() == null)
                    {
                        multipleResults = false;
                    }
                }
            }
            else
            {
                Bid.Trace("<oledb.IUnknown.QueryInterface|API|OLEDB|ADODB> ADORecordConstruction\n");
                record = adodb as System.Data.Common.UnsafeNativeMethods.ADORecordConstruction;
                if (record != null)
                {
                    multipleResults = false;
                }
            }
            int num = 0;

            if (recordset == null)
            {
                if (record == null)
                {
                    throw ODB.Fill_NotADODB("adodb");
                }
                num = this.FillFromRecord(data, record, srcTable);
                if (flag)
                {
                    this.FillClose(false, record);
                }
                return(num);
            }
            int index = 0;

            object[] objArray = new object[1];
Label_0068:
            sourceTableName = null;
            if (data is DataSet)
            {
                sourceTableName = GetSourceTableName(srcTable, index);
            }
            num += this.FillFromRecordset(data, recordset, sourceTableName, out flag2);
            if (multipleResults)
            {
                object obj2;
                object obj4;
                objArray[0] = DBNull.Value;
                Bid.Trace("<oledb.Recordset15.NextRecordset|API|ADODB>\n");
                OleDbHResult result = ((System.Data.Common.UnsafeNativeMethods.Recordset15)adodb).NextRecordset(out obj4, out obj2);
                Bid.Trace("<oledb.Recordset15.NextRecordset|API|ADODB|RET> %08X{HRESULT}\n", result);
                if (OleDbHResult.S_OK > result)
                {
                    if (((OleDbHResult)(-2146825037)) != result)
                    {
                        System.Data.Common.UnsafeNativeMethods.IErrorInfo ppIErrorInfo = null;
                        System.Data.Common.UnsafeNativeMethods.GetErrorInfo(0, out ppIErrorInfo);
                        string message = string.Empty;
                        if (ppIErrorInfo != null)
                        {
                            ODB.GetErrorDescription(ppIErrorInfo, result, out message);
                        }
                        throw new COMException(message, (int)result);
                    }
                }
                else
                {
                    adodb = obj2;
                    if (adodb != null)
                    {
                        Bid.Trace("<oledb.IUnknown.QueryInterface|API|OLEDB|ADODB> ADORecordsetConstruction\n");
                        recordset = (System.Data.Common.UnsafeNativeMethods.ADORecordsetConstruction)adodb;
                        if (flag2)
                        {
                            index++;
                        }
                        if (recordset != null)
                        {
                            goto Label_0068;
                        }
                    }
                }
            }
            if ((recordset != null) && (flag || (adodb == null)))
            {
                this.FillClose(true, recordset);
            }
            return(num);
        }