Export (0) Print
Expand All

SqlDataReader.GetString Method

Gets the value of the specified column as a string.

[Visual Basic]
Public Overridable Function GetString( _
   ByVal i As Integer _
) As String Implements IDataRecord.GetString
[C#]
public virtual string GetString(
 int i
);
[C++]
public: virtual String* GetString(
 int i
);
[JScript]
public function GetString(
   i : int
) : String;

Parameters

i
The zero-based column ordinal.

Return Value

The value of the specified column.

Implements

IDataRecord.GetString

Exceptions

Exception Type Condition
InvalidCastException The specified cast is not valid.

Remarks

No conversions are performed; therefore the data retrieved must already be a string.

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

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework

See Also

SqlDataReader Class | SqlDataReader Members | System.Data.SqlClient Namespace

Show:
© 2014 Microsoft