当前位置: 首页>>代码示例>>C#>>正文


C# IDataReader.NextResult方法代码示例

本文整理汇总了C#中IDataReader.NextResult方法的典型用法代码示例。如果您正苦于以下问题:C# IDataReader.NextResult方法的具体用法?C# IDataReader.NextResult怎么用?C# IDataReader.NextResult使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IDataReader的用法示例。


在下文中一共展示了IDataReader.NextResult方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: NDataReader

		/// <summary>
		/// Creates a NDataReader from a <see cref="IDataReader" />
		/// </summary>
		/// <param name="reader">The <see cref="IDataReader" /> to get the records from the Database.</param>
		/// <param name="isMidstream"><see langword="true" /> if we are loading the <see cref="IDataReader" /> in the middle of reading it.</param>
		/// <remarks>
		/// NHibernate attempts to not have to read the contents of an <see cref="IDataReader"/> into memory until it absolutely
		/// has to.  What that means is that it might have processed some records from the <see cref="IDataReader"/> and will
		/// pick up the <see cref="IDataReader"/> midstream so that the underlying <see cref="IDataReader"/> can be closed 
		/// so a new one can be opened.
		/// </remarks>
		public NDataReader(IDataReader reader, bool isMidstream)
		{
			ArrayList resultList = new ArrayList(2);

			try
			{
				// if we are in midstream of processing a DataReader then we are already
				// positioned on the first row (index=0)
				if (isMidstream)
				{
					currentRowIndex = 0;
				}

				// there will be atleast one result 
				resultList.Add(new NResult(reader, isMidstream));

				while (reader.NextResult())
				{
					// the second, third, nth result is not processed midstream
					resultList.Add(new NResult(reader, false));
				}

				results = (NResult[]) resultList.ToArray(typeof(NResult));
			}
			catch (Exception e)
			{
				throw new ADOException("There was a problem converting an IDataReader to NDataReader", e);
			}
			finally
			{
				reader.Close();
			}
		}
开发者ID:tkellogg,项目名称:NHibernate3-withProxyHooks,代码行数:44,代码来源:NDataReader.cs

示例2: FillEmailCollection

        private static List<EmailInfo> FillEmailCollection(IDataReader reader, out int totalRecords)
        {
            List<EmailInfo> retVal;
            totalRecords = 0;
            try
            {
                retVal = ObjectHelper.FillCollection<EmailInfo>(reader, false);

                //Get the next result (containing the total)
                reader.NextResult();

                //Get the total no of records from the second result
                if (reader.Read())
                {
                    totalRecords = Convert.ToInt32(reader[0]);
                }

            }
            finally
            {
                //close datareader
                ObjectHelper.CloseDataReader(reader, true);
            }
            return retVal;
        }
开发者ID:haoas,项目名称:CRMTPE,代码行数:25,代码来源:EmailRepository.cs

示例3: InMemoryDataReader

        /// <summary>
        ///  Creates an InMemoryDataReader from a <see cref="IDataReader" />
        /// </summary>
        /// <param name="reader">The <see cref="IDataReader" /> which holds the records from the Database.</param>
        public InMemoryDataReader(IDataReader reader)
        {
            ArrayList resultList = new ArrayList();

            try
            {
                _currentResultIndex = 0;
                _currentRowIndex = 0;

                resultList.Add( new InMemoryResultSet( reader, true ) );

                while( reader.NextResult() )
                {
                    resultList.Add( new InMemoryResultSet( reader, false ) );
                }

                _results = ( InMemoryResultSet[ ] ) resultList.ToArray( typeof( InMemoryResultSet ) );
            }
            catch( Exception e )
            {
                throw new DataMapperException( "There was a problem converting an IDataReader to an InMemoryDataReader", e );
            }
            finally
            {
                reader.Close();
                reader.Dispose();
            }
        }
开发者ID:hejiquan,项目名称:iBATIS_2010,代码行数:32,代码来源:InMemoryDataReader.cs

示例4: GetTotais

        /**
         * Assume que o result set em IDataReader reader contem na coluna 0 um ID (long), na coluna 1 a designacao (string),
         * na coluna 2 um valor (long) e, opcionalmente, na coluna 3 um outro valor (long).
         * 
         * Se existirem mais colunas, estas sao ignoradas.
         */
        protected List<TotalTipo> GetTotais(IDataReader reader) {
            List<TotalTipo> results = new List<TotalTipo>();
            TotalTipo tt;
            long total = 0;
            long total_editadas = 0;
            long total_eliminadas = 0;
            do {
                while (reader.Read()) {
                    tt = new TotalTipo();
                    tt.ID = System.Convert.ToInt64(reader.GetValue(0));
                    tt.Designacao = reader.GetValue(1).ToString();
                    tt.Contador = System.Convert.ToInt64(reader.GetValue(2));

                    // Quarta coluna (se existir) contem o valor de 'Editadas':
                    if (reader.FieldCount > 3) {
                        tt.Contador_Editadas = System.Convert.ToInt64(reader.GetValue(3));
                        total_editadas += tt.Contador_Editadas;
                        tt.Contador_Eliminadas = System.Convert.ToInt64(reader.GetValue(4));
                        total_eliminadas += tt.Contador_Eliminadas;
                    }
                    results.Add(tt);
                    total += tt.Contador;
                }
            } while (reader.NextResult());

            tt = new TotalTipo();
            tt.ID = -1;
            tt.Designacao = "Total";
            tt.Contador = total;
            tt.Contador_Editadas = total_editadas;
            tt.Contador_Eliminadas = total_eliminadas;
            results.Add(tt);
            return results;
        }
开发者ID:aureliopires,项目名称:gisa,代码行数:40,代码来源:EstatisticasRule.cs

示例5: DataReaderToDataSet

        public static DataSet DataReaderToDataSet(IDataReader reader)
        {
            var ds = new DataSet();
            DataTable table;
            do
            {
                int fieldCount = reader.FieldCount;
                table = new DataTable();
                for (int i = 0; i < fieldCount; i++)
                {
                    table.Columns.Add(reader.GetName(i), reader.GetFieldType(i));
                }
                table.BeginLoadData();
                var values = new Object[fieldCount];
                while (reader.Read())
                {
                    reader.GetValues(values);
                    table.LoadDataRow(values, true);
                }
                table.EndLoadData();

                ds.Tables.Add(table);

            } while (reader.NextResult());
            reader.Close();
            return ds;
        }
开发者ID:samnuriu13,项目名称:APIXERP,代码行数:27,代码来源:Util.cs

示例6: FillGroupCollection

        private static List<GroupInfo> FillGroupCollection(IDataReader reader, out int totalRecords)
        {
            var retVal = ObjectHelper.FillCollection<GroupInfo>(reader, false);
            totalRecords = 0;
            try
            {
                //Get the next result (containing the total)
                reader.NextResult();

                //Get the total no of records from the second result
                if (reader.Read())
                {
                    totalRecords = Convert.ToInt32(reader[0]);
                }

            }
            catch
            {
                //DotNetNuke.Services.Exceptions.Exceptions.LogException(exc);
            }
            finally
            {
                //close datareader
                ObjectHelper.CloseDataReader(reader, true);
            }
            return retVal;
        }
开发者ID:haoas,项目名称:CRMTPE,代码行数:27,代码来源:GroupRepository.cs

示例7: MapReader

        /// <summary>
        /// Creates one instance of Type T
        /// </summary>        
        /// <param name="reader">Reader with the query result</param>
        /// <param name="prefix">Optional prefix to identify relevant rows in the query results</param>
        /// <returns>Instance of object type.</returns>
        internal static RoomInformation MapReader(IDataReader reader, string prefix = "")
        {
            var roomInfo = new RoomInformation
            {
                RoomTypes = new List<RoomType>(),
            };

            //get all room types associated with the business
            while (reader.Read())
            {
                roomInfo.RoomTypes.Add(RoomTypeMapper.MapRecordWithCode(reader));
            }

            // Populate rooms, nested inside the room types
            if (reader.NextResult())
            {
                while (reader.Read())
                {
                    //get all rooms and combined rooms associated with the business
                    var room = RoomMapper.MapRecord(reader);
                    roomInfo.RoomTypes.Find(rt => rt.Id == room.RoomTypeId).Rooms.Add(room);
                }
            }

            if (roomInfo.RoomTypes.Count == 0)
            {
                roomInfo = null;
            }

            return roomInfo;
        }
开发者ID:ognjenm,项目名称:egle,代码行数:37,代码来源:RoomInformationMapper.cs

示例8: ToMultipleDictionariesImpl

 private static IEnumerable<IEnumerable<IDictionary<string,object>>> ToMultipleDictionariesImpl(IDataReader reader)
 {
     do
     {
         yield return ToDictionariesImpl(reader).ToArray().AsEnumerable();
     } while (reader.NextResult());
     
 }
开发者ID:dezfowler,项目名称:Simple.Data,代码行数:8,代码来源:DataReaderExtensions.cs

示例9: SimpleIDValueRetrieve

 public static object SimpleIDValueRetrieve(int? id, IDataReader data, String columnName)
 {
     object result = null;
     while (data.NextResult())
     {
         int rowID = (int)data["ID"];
         if (rowID == id.Value)
         {
             return data[columnName];
         }
     }
     return result;
 }
开发者ID:bneuhold,项目名称:EFQM,代码行数:13,代码来源:DataBridge.cs

示例10: DataReaderToExcelFile

        public static void DataReaderToExcelFile(IDataReader reader, string saveFileName, List<SheetOptions> optionsList)
        {
            if (reader == null) throw new ArgumentNullException("reader");
            if (string.IsNullOrWhiteSpace(saveFileName)) throw new ArgumentException("字符串参数不允许为null或者空值.", saveFileName);
            // 创建一个空Xls文档
            XlsDocument xls = new XlsDocument();

            int sheetIndex = 0;
            int sheetDefaultNameIndex = 1;
            do
            {
                // 创建一个工作表
                SheetOptions options = (optionsList == null || sheetIndex >= optionsList.Count)
                    ? options = new SheetOptions() { SheetName = SheetOptions.DefaultSheetName + (sheetDefaultNameIndex++).ToString() }
                    : optionsList[sheetIndex];
                Worksheet sheet = xls.Workbook.Worksheets.Add(options.SheetName);

                // 创建表格数据

                if (reader.Read())
                {
                    // 标题
                    ushort rowNo = 1,
                        columnNo = 1;
                    int fieldCnt = reader.FieldCount;
                    for (int i = 0; i < fieldCnt; i++, columnNo++)
                    {
                        sheet.Cells.Add(rowNo, columnNo, reader.GetName(i));
                    }

                    // 正文数据
                    do
                    {
                        rowNo++;

                        columnNo = 1;
                        for (int i = 0; i < fieldCnt; i++, columnNo++)
                        {
                            string value = Convert.ToString(reader[i]);  // null值将显示为空
                            sheet.Cells.Add(rowNo, columnNo, value);
                        }
                    } while (reader.Read());
                }

                sheetIndex++;
            } while (reader.NextResult());

            trySaveXlsFile(xls, saveFileName);
        }
开发者ID:zfiter,项目名称:netdev,代码行数:49,代码来源:MyXlsUtil.cs

示例11: GetTableSet

 public static IEnumerable<Table> GetTableSet(IDataReader reader){
     var wasnextresult = true;
     Table t = null;
     while (reader.Read() || (wasnextresult = (reader.NextResult() && reader.Read()))){
         if (wasnextresult){
             if (null != t) yield return t;
             t = initNewTable(reader);
             wasnextresult = false;
         }
         var r = new Row();
         for (var i = 0; i < reader.FieldCount; i++)
             r.Values.Add(reader[i]);
         t.Rows.Add(r);
     }
     if (null != t) yield return t;
 }
开发者ID:Qorpent,项目名称:comdiv.oldcore,代码行数:16,代码来源:Table.cs

示例12: GetDataFromDb

 protected void GetDataFromDb(IDataReader dataReader)
 {
     int i = 0;
     do
     {
         switch (i)
         {
             case 0:
                 AllRolesFromDb(dataReader);
                 break;
             case 1:
                 MaxIdFromId(dataReader);
                 break;
         }
         i++;
     } while (dataReader.NextResult());
 }
开发者ID:karavanjo,项目名称:osmarser,代码行数:17,代码来源:RelationsRolesRepository.cs

示例13: FillAppointmentInterviewCollection

        private static List<AppointmentInterviewInfo> FillAppointmentInterviewCollection(IDataReader reader, out int totalRecords)
        {
            var retVal = new List<AppointmentInterviewInfo>();
            totalRecords = 0;
            try
            {
                while (reader.Read())
                {
                    //fill business object
                    var info = new AppointmentInterviewInfo();
                    /*

                    info.ContactId = ConvertHelper.ToInt32(reader["ContactId"]);

                    info.UserId = ConvertHelper.ToInt32(reader["UserId"]);

                    info.TimeSlotId = ConvertHelper.ToInt32(reader["TimeSlotId"]);

                    info.Notes = ConvertHelper.ToString(reader["Notes"]);

                    info.StatusInterviewId = ConvertHelper.ToInt32(reader["StatusInterviewId"]);

                    info.TeacherTypeId = ConvertHelper.ToInt32(reader["TeacherTypeId"]);

                    info.CasecAccountId = ConvertHelper.ToInt32(reader["CasecAccountId"]);

                    */
                    retVal.Add(info);
                }
                //Get the next result (containing the total)
                reader.NextResult();

                //Get the total no of records from the second result
                if (reader.Read())
                {
                    totalRecords = Convert.ToInt32(reader[0]);
                }

            }
            finally
            {
                //close datareader
                ObjectHelper.CloseDataReader(reader, true);
            }
            return retVal;
        }
开发者ID:haoas,项目名称:CRMTPE,代码行数:46,代码来源:AppointmentInterviewRepository.cs

示例14: FillSourceTypCollection

        private static List<SourceTypeInfo> FillSourceTypCollection(IDataReader reader, out int totalRecords)
        {
            List<SourceTypeInfo> retVal;
            totalRecords = 0;
            try
            {
                retVal = ObjectHelper.FillCollection<SourceTypeInfo>(reader, false);

                reader.NextResult();
                if (reader.Read()) totalRecords = reader[0].ToInt32();
            }
            finally
            {
                ObjectHelper.CloseDataReader(reader, true);
            }
            return retVal;
        }
开发者ID:haoas,项目名称:CRMTPE,代码行数:17,代码来源:SourceTypeRepository.cs

示例15: DisconnectedReader

        /// <summary>
        /// Caches a data reader to enable disconnected data access via the IDataReader interface.
        /// </summary>
        /// <param name="reader">The IDataReader to cache.</param>
        public DisconnectedReader(IDataReader reader)
        {
            // Cache field information
            this.fields = new FieldInfo[reader.FieldCount];
            this.ordinals = new Hashtable(StringComparer.OrdinalIgnoreCase);
            for (int index = 0; index < fields.Length; index++)
            {
                FieldInfo field = new FieldInfo();
                field.Name = reader.GetName(index);
                field.Type = reader.GetFieldType(index);
                field.DataTypeName = reader.GetDataTypeName(index);
                fields[index] = field;
                if (!ordinals.Contains(field.Name))
                    ordinals.Add(field.Name, index);
            }

            // Cache schema info
            schema = reader.GetSchemaTable();

            // Cache row data
            rows = new ArrayList();
            while (reader.Read())
            {
                object[] values = new object[fields.Length];
                reader.GetValues(values);
                rows.Add(values);
            }

            // Cache additional results
            if (reader.NextResult())
                nextResult = new DisconnectedReader(reader);

            // Close the reader once all data has been cached
            else
                reader.Dispose();

            // Set the record index before the first record;
            this.recordIndex = -1;

            this.lastIndex = rows.Count - 1;
        }
开发者ID:vc3,项目名称:Amnesia,代码行数:45,代码来源:DisconnectedReader.cs


注:本文中的IDataReader.NextResult方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。