SqlDataReader.Item[] Property

Definition

Gets the value of a column in its native format.

Overloads

Item[String]

Gets the value of the specified column in its native format given the column name.

Item[Int32]

Gets the value of the specified column in its native format given the column ordinal.

Item[String]

Source:
System.Data.SqlClient.notsupported.cs

Gets the value of the specified column in its native format given the column name.

C#
public override object this[string name] { get; }
C#
public object this[string name] { get; }

Parameters

name
String

The column name.

Property Value

The value of the specified column in its native format.

Implements

Exceptions

No column with the specified name was found.

Remarks

A case-sensitive lookup is performed first. If it fails, a second case-insensitive search is made (a case-insensitive comparison is done using the database collation). Unexpected results can occur when comparisons are affected by culture-specific casing rules. For example, in Turkish, the following example yields the wrong results because the file system in Turkish does not use linguistic casing rules for the letter 'i' in "file".

This method is kana-width insensitive.

See also

Applies to

.NET 10 (package-provided) and other versions
Product Versions
.NET Core 1.0, Core 1.1, 6 (package-provided), 7 (package-provided), 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)

Item[Int32]

Source:
System.Data.SqlClient.notsupported.cs

Gets the value of the specified column in its native format given the column ordinal.

C#
public override object this[int i] { get; }
C#
public object this[int i] { get; }

Parameters

i
Int32

The zero-based column ordinal.

Property Value

The value of the specified column in its native format.

Implements

Exceptions

The index passed was outside the range of 0 through FieldCount.

See also

Applies to

.NET 10 (package-provided) and other versions
Product Versions
.NET Core 1.0, Core 1.1, 6 (package-provided), 7 (package-provided), 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)