System.Data.DataTableReader.GetValue C# (CSharp) Method

GetValue() public method

public GetValue ( int ordinal ) : object
ordinal int
return object
        public override object GetValue(int ordinal)
        {
            ValidateState(nameof(GetValue));
            ValidateReader();
            try
            {
                return _currentDataRow[ordinal];
            }
            catch (IndexOutOfRangeException e)
            {
                // thrown by DataColumnCollection
                ExceptionBuilder.TraceExceptionWithoutRethrow(e);
                throw ExceptionBuilder.ArgumentOutOfRange(nameof(ordinal));
            }
        }

Usage Example

Esempio n. 1
0
 private void RellenaEtiquetasPlaceHolder()
 {
     if (this.idindicator.HasValue)
     {
         try
         {
             using (Clases.cKPI_INDICATOR_ETIQUETAS objEtiquetas = new Clases.cKPI_INDICATOR_ETIQUETAS())
             {
                 objEtiquetas.indicatorid = this.idindicator.Value;
                 System.Data.DataTableReader dtrValores = objEtiquetas.ObtenerDatos().CreateDataReader();
                 while (dtrValores.Read())
                 {
                     HyperLink NuevoEnlace = new HyperLink();
                     NuevoEnlace.Text        = dtrValores.GetValue(2).ToString();
                     NuevoEnlace.NavigateUrl = "~/search.aspx?tagstring=" + dtrValores.GetValue(2).ToString();
                     NuevoEnlace.CssClass    = "tag";
                     PlaceHolderEtiquetas.Controls.Add(NuevoEnlace);
                 }
             }
         }
         catch (Exception excp)
         {
             ExceptionUtility.LogException(excp, "Error en la función << RellenaEtiquetasPlaceHolder() >>");
         }
         finally
         {
             if (PlaceHolderEtiquetas.Controls.Count > 0)
             {
                 lbNumEtiquetasNoEditable.Text = PlaceHolderEtiquetas.Controls.Count.ToString();
             }
             else
             {
                 PanelEtiquetasNoEditable.Visible = false;
             }
         }
     }
     else
     {
         Response.Redirect("~/errors/notfound.aspx");
     }
 }
All Usage Examples Of System.Data.DataTableReader::GetValue