DataColumn

Inheritance: java.lang.Object

public class DataColumn

Represents the schema of a column in a DataTable.

Constructors

ConstructorDescription
DataColumn()Initializes a new instance of a DataColumn class as type string.
DataColumn(String columnName)Inititalizes a new instance of the DataColumn class, as type string, using the specified column name.
DataColumn(String name, System.Data.DataTable table)Initializes a new instance of the @{link DataColumn} class using the specified column name and table it belongs to.
DataColumn(String columnName, Class dataType)Inititalizes a new instance of the DataColumn class using the specified column name and data type.
DataColumn(String name, Class type, System.Data.DataTable table)Initializes a new instance of the DataColumn class using the specified column name, data type and data table it belongs to.

Methods

MethodDescription
areColumnSetsTheSame(System.Data.DataColumn[] columnSet, System.Data.DataColumn[] compareSet)
getAllowDBNull()Gets a value that indicates whether null values are allowed in this column for rows that belong to the table.
getAutoIncrement()Gets a value that indicates whether the column automatically increments the value of the column for new rows added to the table.
getAutoIncrementSeed()Gets the starting value for a column that has its getAutoIncrement() / setAutoIncrement(boolean) property set to true.
getAutoIncrementStep()Gets the increment used by a column with its getAutoIncrement() / setAutoIncrement(boolean) property set to true.
getCaption()Gets the caption for the column.
getColumnMapping()Gets the MappingType of the column.
getColumnName()Gets the name of the column in the DataColumnCollection.
getDataType()Gets the type of data stored in the column.
getDefaultValue()Gets the default value for the column when you are creating new rows.
getExpression()Gets the expression used to filter rows, calculate the values in a column, or create an aggregate column.
getMaxLength()Gets the maximum length of a text column.
getNamespace()Gets the namespace of the DataColumn.
getOrdinal()Gets the position of the column in the DataColumnCollection collection.
getPrefix()Gets an XML prefix that aliases the namespace of the DataTable.
getReadOnly()Gets a value that indicates whether the column allows for changes as soon as a row has been added to the table.
getTable()Gets the DataTable to which the column belongs to.
getUnique()Gets a value that indicates whether the values in each row of the column must be unique.
isReadOnly()
isUnique()
setAllowDBNull(boolean value)Sets a value that indicates whether null values are allowed in this column for rows that belong to the table.
setAutoIncrement(boolean value)Sets a value that indicates whether the column automatically increments the value of the column for new rows added to the table.
setAutoIncrementSeed(long value)Sets the starting value for a column that has its getAutoIncrement() / setAutoIncrement(boolean) property set to true.
setAutoIncrementStep(long value)Sets the increment used by a column with its getAutoIncrement() / setAutoIncrement(boolean) property set to true.
setCaption(String value)Sets the caption for the column.
setColumnMapping(int value)Sets the MappingType of the column.
setColumnName(String value)Sets the name of the column in the DataColumnCollection.
setDataType(Class value)Sets the type of data stored in the column.
setDefaultValue(Object value)Sets the default value for the column when you are creating new rows.
setMaxLength(int value)Sets the maximum length of a text column.
setNamespace(String value)Sets the namespace of the DataColumn.
setOrdinal(int ordinal)Changes the ordinal or position of the DataColumn to the specified ordinal or position.
setPrefix(String value)Sets an XML prefix that aliases the namespace of the DataTable.
setReadOnly(boolean value)Sets a value that indicates whether the column allows for changes as soon as a row has been added to the table.
setUnique(boolean value)Sets a value that indicates whether the values in each row of the column must be unique.
toString()Gets the getExpression() of the column, if one exists.

DataColumn()

public DataColumn()

Initializes a new instance of a DataColumn class as type string.

DataColumn(String columnName)

public DataColumn(String columnName)

Inititalizes a new instance of the DataColumn class, as type string, using the specified column name.

Parameters:

ParameterTypeDescription
columnNamejava.lang.StringA string that represents the name of the column to be created. If set to null or an empty string (""), a default name will be specified when added to the columns collection.

DataColumn(String name, System.Data.DataTable table)

public DataColumn(String name, System.Data.DataTable table)

Initializes a new instance of the @{link DataColumn} class using the specified column name and table it belongs to.

Parameters:

ParameterTypeDescription
namejava.lang.Stringname of the DataColumn
tableDataTablethe table this column belongs to

DataColumn(String columnName, Class dataType)

public DataColumn(String columnName, Class dataType)

Inititalizes a new instance of the DataColumn class using the specified column name and data type.

Parameters:

ParameterTypeDescription
columnNamejava.lang.StringA string that represents the name of the column to be created. If set to null or an empty string (""), a default name will be specified when added to the columns collection.
dataTypejava.lang.ClassA supported getDataType() / setDataType(java.lang.Class).

DataColumn(String name, Class type, System.Data.DataTable table)

public DataColumn(String name, Class type, System.Data.DataTable table)

Initializes a new instance of the DataColumn class using the specified column name, data type and data table it belongs to.

Parameters:

ParameterTypeDescription
namejava.lang.Stringname of the DataColumn
typejava.lang.Classdata type
tableDataTablethe table this column belongs to

areColumnSetsTheSame(System.Data.DataColumn[] columnSet, System.Data.DataColumn[] compareSet)

public static boolean areColumnSetsTheSame(System.Data.DataColumn[] columnSet, System.Data.DataColumn[] compareSet)

Parameters:

ParameterTypeDescription
columnSetDataColumn[]
compareSetDataColumn[]

Returns: boolean

getAllowDBNull()

public boolean getAllowDBNull()

Gets a value that indicates whether null values are allowed in this column for rows that belong to the table.

Returns: boolean - true if null values values are allowed; otherwise, false. The default is true.

getAutoIncrement()

public boolean getAutoIncrement()

Gets a value that indicates whether the column automatically increments the value of the column for new rows added to the table.

Returns: boolean - true if the value of the column increments automatically; otherwise, false. The default is false.

getAutoIncrementSeed()

public long getAutoIncrementSeed()

Gets the starting value for a column that has its getAutoIncrement() / setAutoIncrement(boolean) property set to true.

Returns: long - The starting value for the getAutoIncrement() / setAutoIncrement(boolean) feature.

getAutoIncrementStep()

public long getAutoIncrementStep()

Gets the increment used by a column with its getAutoIncrement() / setAutoIncrement(boolean) property set to true.

Returns: long - The number by which the value of the column is automatically incremented. The default is 1.

getCaption()

public String getCaption()

Gets the caption for the column.

Returns: java.lang.String - The caption of the column. If not set, returns the getColumnName() / setColumnName(java.lang.String) value.

getColumnMapping()

public int getColumnMapping()

Gets the MappingType of the column.

Returns: int - One of the MappingType values. The returned value is one of MappingType constants.

getColumnName()

public String getColumnName()

Gets the name of the column in the DataColumnCollection.

Returns: java.lang.String - The name of the column.

getDataType()

public Class getDataType()

Gets the type of data stored in the column.

Returns: java.lang.Class - A java.lang.Class object that represents the column data type.

getDefaultValue()

public Object getDefaultValue()

Gets the default value for the column when you are creating new rows.

Returns: java.lang.Object - A value appropriate to the column’s getDataType() / setDataType(java.lang.Class).

getExpression()

public String getExpression()

Gets the expression used to filter rows, calculate the values in a column, or create an aggregate column.

Returns: java.lang.String - An expression to calculate the value of a column, or create an aggregate column. The return type of an expression is determined by the getDataType() / setDataType(java.lang.Class) of the column.

getMaxLength()

public int getMaxLength()

Gets the maximum length of a text column.

Returns: int - The maximum length of the column in characters. If the column has no maximum length, the value is -1 (default).

getNamespace()

public String getNamespace()

Gets the namespace of the DataColumn.

Returns: java.lang.String - The namespace of the DataColumn.

getOrdinal()

public int getOrdinal()

Gets the position of the column in the DataColumnCollection collection.

Returns: int - The position of the column. Gets -1 if the column is not a member of a collection.

getPrefix()

public String getPrefix()

Gets an XML prefix that aliases the namespace of the DataTable.

Returns: java.lang.String - The XML prefix for the DataTable namespace.

getReadOnly()

public boolean getReadOnly()

Gets a value that indicates whether the column allows for changes as soon as a row has been added to the table.

Returns: boolean - true if the column is read only; otherwise, false. The default is false.

getTable()

public System.Data.DataTable getTable()

Gets the DataTable to which the column belongs to.

Returns: DataTable - The DataTable that the DataColumn belongs to.

getUnique()

public boolean getUnique()

Gets a value that indicates whether the values in each row of the column must be unique.

Returns: boolean - true if the value must be unique; otherwise, false. The default is false.

isReadOnly()

public boolean isReadOnly()

Returns: boolean

isUnique()

public boolean isUnique()

Returns: boolean

setAllowDBNull(boolean value)

public void setAllowDBNull(boolean value)

Sets a value that indicates whether null values are allowed in this column for rows that belong to the table.

Parameters:

ParameterTypeDescription
valuebooleantrue if null values values are allowed; otherwise, false. The default is true.

setAutoIncrement(boolean value)

public void setAutoIncrement(boolean value)

Sets a value that indicates whether the column automatically increments the value of the column for new rows added to the table.

Parameters:

ParameterTypeDescription
valuebooleantrue if the value of the column increments automatically; otherwise, false. The default is false.

setAutoIncrementSeed(long value)

public void setAutoIncrementSeed(long value)

Sets the starting value for a column that has its getAutoIncrement() / setAutoIncrement(boolean) property set to true.

Parameters:

ParameterTypeDescription
valuelongThe starting value for the getAutoIncrement() / setAutoIncrement(boolean) feature.

setAutoIncrementStep(long value)

public void setAutoIncrementStep(long value)

Sets the increment used by a column with its getAutoIncrement() / setAutoIncrement(boolean) property set to true.

Parameters:

ParameterTypeDescription
valuelongThe number by which the value of the column is automatically incremented. The default is 1.

setCaption(String value)

public void setCaption(String value)

Sets the caption for the column.

Parameters:

ParameterTypeDescription
valuejava.lang.StringThe caption of the column. If not set, returns the getColumnName() / setColumnName(java.lang.String) value.

setColumnMapping(int value)

public void setColumnMapping(int value)

Sets the MappingType of the column.

Parameters:

ParameterTypeDescription
valueintOne of the MappingType values. The value must be one of MappingType constants.

setColumnName(String value)

public void setColumnName(String value)

Sets the name of the column in the DataColumnCollection.

Parameters:

ParameterTypeDescription
valuejava.lang.StringThe name of the column.

setDataType(Class value)

public void setDataType(Class value)

Sets the type of data stored in the column.

Parameters:

ParameterTypeDescription
valuejava.lang.ClassA java.lang.Class object that represents the column data type.

setDefaultValue(Object value)

public void setDefaultValue(Object value)

Sets the default value for the column when you are creating new rows.

Parameters:

ParameterTypeDescription
valuejava.lang.ObjectA value appropriate to the column’s getDataType() / setDataType(java.lang.Class).

setMaxLength(int value)

public void setMaxLength(int value)

Sets the maximum length of a text column.

Parameters:

ParameterTypeDescription
valueintThe maximum length of the column in characters. If the column has no maximum length, the value is -1 (default).

setNamespace(String value)

public void setNamespace(String value)

Sets the namespace of the DataColumn.

Parameters:

ParameterTypeDescription
valuejava.lang.StringThe namespace of the DataColumn.

setOrdinal(int ordinal)

public void setOrdinal(int ordinal)

Changes the ordinal or position of the DataColumn to the specified ordinal or position.

Parameters:

ParameterTypeDescription
ordinalintThe specified ordinal.

setPrefix(String value)

public void setPrefix(String value)

Sets an XML prefix that aliases the namespace of the DataTable.

Parameters:

ParameterTypeDescription
valuejava.lang.StringThe XML prefix for the DataTable namespace.

setReadOnly(boolean value)

public void setReadOnly(boolean value)

Sets a value that indicates whether the column allows for changes as soon as a row has been added to the table.

Parameters:

ParameterTypeDescription
valuebooleantrue if the column is read only; otherwise, false. The default is false.

setUnique(boolean value)

public void setUnique(boolean value)

Sets a value that indicates whether the values in each row of the column must be unique.

Parameters:

ParameterTypeDescription
valuebooleantrue if the value must be unique; otherwise, false. The default is false.

toString()

public String toString()

Gets the getExpression() of the column, if one exists.

Returns: java.lang.String - The getExpression() value, if the property is set; otherwise, the getColumnName() / setColumnName(java.lang.String) property.