SqlDataReader.FieldCount Propriedade

Definição

Obtém o número de colunas na linha atual.Gets the number of columns in the current row.

public:
 virtual property int FieldCount { int get(); };
public:
 property int FieldCount { int get(); };
public override int FieldCount { get; }
public int FieldCount { get; }
member this.FieldCount : int
Public Overrides ReadOnly Property FieldCount As Integer
Public ReadOnly Property FieldCount As Integer

Valor da propriedade

Int32

Quando não estiver posicionado em um conjunto de registros válido, 0. Caso contrário, o número de colunas na linha atual.When not positioned in a valid recordset, 0; otherwise the number of columns in the current row. O padrão é -1.The default is -1.

Implementações

Exceções

Não há conexão atual com uma instância do SQL Server.There is no current connection to an instance of SQL Server.

Comentários

A execução de uma consulta que, por sua natureza, não retorna linhas (como uma consulta DELETE), define FieldCount como 0.Executing a query that, by its nature, does not return rows (such as a DELETE query), sets FieldCount to 0. No entanto,However. Isso não deve ser confundido com uma consulta que retorna 0 linhas (como SELECT * da tabela em que 1 = 2). nesse caso FieldCount , retorna o número de colunas na tabela, incluindo campos ocultos.this should not be confused with a query that returns 0 rows (such as SELECT * FROM table WHERE 1 = 2) in which case FieldCount returns the number of columns in the table, including hidden fields. Use VisibleFieldCount para excluir campos ocultos.Use VisibleFieldCount to exclude hidden fields.

Aplica-se a