SqlMetaData.MaxLength Property

Definition

Gets the maximum length of the column or parameter.

public:
 property long MaxLength { long get(); };
public long MaxLength { get; }
member this.MaxLength : int64
Public ReadOnly Property MaxLength As Long

Property Value

The maximum length of the column or parameter as a Int64.

Remarks

The potential maximum length for values of the specified column. Returns 0 for types other than fixed and varying length character and binary types. For variable size columns or parameters declared with the Max constructor parameter, it returns -1.

For DbType.Row this returns the number of columns in the row metadata instance.

The default value is 0.

Applies to