Share via


SqlColumnBinder Class

This class is a convienent way to efficiently access result columns. It caches column ordinals.

To use this class, create a static instance of it, pass in the column name to the constructor, and use the GetXXX methods at runtime to retrieve the values.

After the first GetXXX() call, the column number will be cached.

This object should be reused for any future calls against the same shape of result set.

Inheritance Hierarchy

System.Object
  Microsoft.TeamFoundation.Framework.Server.SqlColumnBinder

Namespace:  Microsoft.TeamFoundation.Framework.Server
Assembly:  Microsoft.TeamFoundation.Framework.Server (in Microsoft.TeamFoundation.Framework.Server.dll)

Syntax

'Declaration
Public Class SqlColumnBinder
public class SqlColumnBinder
public ref class SqlColumnBinder
type SqlColumnBinder =  class end
public class SqlColumnBinder

The SqlColumnBinder type exposes the following members.

Constructors

  Name Description
Public method SqlColumnBinder Creates a SqlColumnReader to read the named column

Top

Properties

  Name Description
Public property ColumnName Name of the column this binder binds too.

Top

Methods

  Name Description
Public method ColumnExists Checks if column is in the result set.
Public method Equals Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected method Finalize Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public method GetBoolean(DbDataReader) Retrieves the value of this column as a bool from the given reader. An exception will be thrown if the column is null
Public method GetBoolean(DbDataReader, Boolean) Retrieves the value of this column as a bool from the given reader. An exception will be thrown if the column is null
Public method GetBoolean(DbDataReader, Boolean, Boolean%) Retrieves the value of this column as a bool from the given reader. Sets the output parameter to true if the value was null.
Public method GetByte(DbDataReader) Retrieves the value of this column as an int from the given reader. An exception will be thrown if the column is null
Public method GetByte(DbDataReader, Byte) Retrieves the value of this column as an int from the given reader. An exception will be thrown if the column is null
Public method GetByte(DbDataReader, Byte, Byte) Retrieves the value of this column as an int from the given reader. An exception will be thrown if the column is null
Public method GetBytes(DbDataReader, Boolean)
Public method GetBytes(DbDataReader, Int64, array<Byte[], Int32, Int32) Read a chunk of bytes from a column. When used with ExecuteReader(CommandBehavior.SequentialAccess), you can efficiently stream bytes from a BLOB column.
Public method GetDateTime(DbDataReader)
Public method GetDateTime(DbDataReader, DateTime)
Public method GetDateTimeOffset
Public method GetDouble(DbDataReader) Retrieves the value of this column as a double from the given reader. An exception will be thrown if the column is null.
Public method GetDouble(DbDataReader, Double) Retrieves the value of this column as a double from the given reader
Public method GetFloat(DbDataReader) Retrieves the value of this column as float from the given reader. An exception will be thrown if the column is null
Public method GetFloat(DbDataReader, Single) Retrieves the value of this column as float from the given reader.
Public method GetFloat(DbDataReader, Single, Single) Retrieves the value of this column as float from the given reader.
Public method GetGuid(DbDataReader)
Public method GetGuid(DbDataReader, Boolean) Retrieves the value of this column as a Guid from the given reader. If allowNulls is true, null values will be returned as empty GUIDs. Otherwise, a SQLException will be thrown if a null is encountered
Public method GetGuid(DbDataReader, Boolean, Guid) Retrieves the value of this column as a Guid from the given reader. If allowNulls is true, null values will be returned as empty GUIDs. Otherwise, a SQLException will be thrown if a null is encountered
Public method GetHashCode Serves as the default hash function. (Inherited from Object.)
Public method GetInt16(DbDataReader) Retrieves the value of this column as an Int16 from the given reader. An exception will be thrown if the column is null or not found in the result set.
Public method GetInt16(DbDataReader, Int16) Retrieves the value of this column as an Int16 from the given reader. An exception will be thrown if the is not found in the result set.
Public method GetInt16(DbDataReader, Int16, Int16) Retrieves the value of this column as an Int16 from the given reader.
Public method GetInt32(DbDataReader) Retrieves the value of this column as an int from the given reader. An exception will be thrown if the column is null
Public method GetInt32(DbDataReader, Int32) Retrieves the value of this column as an int from the given reader.
Public method GetInt32(DbDataReader, Int32, Int32) Retrieves the value of this column as an int from the given reader.
Public method GetInt64(DbDataReader) Retrieves the value of this column as an int from the given reader. An exception will be thrown if the column is null
Public method GetInt64(DbDataReader, Int64) Retrieves the value of this column as an int from the given reader.
Public method GetInt64(DbDataReader, Int64, Int64) Retrieves the value of this column as an int64 from the given reader.
Public method GetObject
Public method GetOrdinal
Public method GetString(DbDataReader, Boolean) Retrieves the value of this column as a string from the given reader. If allowNulls is true, null values will be returned as null strings. Otherwise, a SQLException will be thrown if a null is encountered
Public method GetString(DbDataReader, String) Retrieves the value of this column as a string from the given reader. null will be returned if DB column is NULL.
Public method GetTimeSpan(SqlDataReader)
Public method GetTimeSpan(SqlDataReader, TimeSpan)
Public method GetTimeSpan(SqlDataReader, TimeSpan, TimeSpan)
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Public method IsInitialized Returns value whether or not a column has been resolved to its ordinal value.
Public method IsNull
Protected method MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Public method ToString Returns a string that represents the current object. (Inherited from Object.)

Top

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

Microsoft.TeamFoundation.Framework.Server Namespace