GetString(int, bool)

This method returns the string value of the specified column and indicates whether to honor the data type's NLS format.

Declaration

// C#
public string GetString(int index, bool providerTypeNLSSensitiveToString)

Parameters

  • index

    The zero-based column index.

  • providerTypeNLSSensitiveToString

    Indicates whether to honor the NLS format.

Return Value

The string value of the column based on the NLS sensitivity setting.

Exceptions

  • InvalidOperationException - The connection is closed, the reader is closed, Read() has not been called, or all rows have been read.

  • IndexOutOfRangeException - The column index is invalid.

  • InvalidCastException - The accessor method is invalid for this column type or the column value is NULL.

Remarks

If providerTypeNLSSensitiveToString is set to true, then the string representation returned by this method honors the session NLS settings for the following data types:

  • NUMBER

  • DATE

  • TIMESTAMP

  • TIMESTAMPLTZ

  • TIMESTAMPTZ

  • FLOAT

  • BINARY FLOAT

  • BINARY DOUBLE

Call the IsDBNull method to check for null values before calling this method.

If the column is an Oracle REF column, the string returned is a hexadecimal string that represents the REF in the database.

For VECTOR columns, the string returned is a JSON string that represents the VECTOR in the database. A sparse vector type column will return a JSON string in sparse format.

A JSON formatted string is returned for the cursor result set from Oracle REF CURSOR columns.