Export (0) Print
Expand All

SqlDataReader.FieldCount Property

Gets the number of columns in the current row.

[Visual Basic]
Public Overridable ReadOnly Property FieldCount As Integer  _
   Implements IDataRecord.FieldCount
[C#]
public virtual int FieldCount {get;}
[C++]
public: __property virtual int get_FieldCount();
[JScript]
public function get FieldCount() : int;

Property Value

When not positioned in a valid recordset, 0; otherwise the number of columns in the current row. The default is -1.

Implements

IDataRecord.FieldCount

Exceptions

Exception Type Condition
NotSupportedException There is no current connection to an instance of SQL Server.

Remarks

After executing a query that does not return rows, FieldCount returns 0.

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:
© 2015 Microsoft