DataTable

Inheritance: java.lang.Object

All Implemented Interfaces: com.aspose.words.net.System.Data.DataTableEventListener

public class DataTable implements System.Data.DataTableEventListener

Represents one table of in-memory data.

Constructors

ConstructorDescription
DataTable()Initializes a new instance of the DataTable class with no arguments.
DataTable(String tableName)Initializes a new instance of the DataTable class with the specified table name.
DataTable(ResultSet resultSet)Creates an object by wrapping the specified ResultSet.
DataTable(ResultSet resultSet, String tableName)Creates an object by wrapping the specified ResultSet.

Methods

MethodDescription
acceptChanges()Commits all the changes made to this table since the last time acceptChanges() was called.
addEventListener(System.Data.DataTableEventListener listener)
clearEventListneers()
close()
containsColumn(String columnName)Check whether the given column exists or not
getChildRelations()Gets the collection of child relations for this DataTable.
getColumnName(int index)Analog for .Net DataTable.Columns[i].ColumnName
getColumns()Gets the collection of columns that belong to this table.
getColumnsCount()
getConstraints()Gets the collection of constraints maintained by this table.
getDataSet()Gets the DataSet to which this table belongs.
getEnforceConstraints()
getNamespace()Gets the namespace for the XML representation of the data stored in the DataTable.
getParentRelations()Gets the collection of parent relations for this DataTable.
getPrimaryKey()Gets an array of columns that function as primary keys for the data table.
getResultSet()Returns the underlying Java ResultSet object.
getRows()Gets the collection of rows that belong to this table.
getTableName()Gets the name of the DataTable.
newRow()Creates a new DataRow with the same schema as the table.
onDataColumnDeleted(System.Data.DataColumn column)
onDataColumnInserted(System.Data.DataColumn column)
onDataRowChanged(System.Data.DataRow row)
onDataRowDeleted(System.Data.DataRow row)
onDataRowInserted(System.Data.DataRow row)
refresh()Reloads all the data from ResultSet if it is present.
setEnforceConstraints(boolean enforceConstraints)
setNamespace(String value)Sets the namespace for the XML representation of the data stored in the DataTable.
setPrimaryKey(System.Data.DataColumn[] value)Sets an array of columns that function as primary keys for the data table.
setTableName(String value)Sets the name of the DataTable.

DataTable()

public DataTable()

Initializes a new instance of the DataTable class with no arguments.

DataTable(String tableName)

public DataTable(String tableName)

Initializes a new instance of the DataTable class with the specified table name.

Parameters:

ParameterTypeDescription
tableNamejava.lang.StringThe name to give the table. If tableName is null or an empty string, a default name is given when added to the DataTableCollection.

DataTable(ResultSet resultSet)

public DataTable(ResultSet resultSet)

Creates an object by wrapping the specified ResultSet. Attempts to retrieve the table name from the metadata of the first column of the ResultSet.

Parameters:

ParameterTypeDescription
resultSetjava.sql.ResultSetdata set

DataTable(ResultSet resultSet, String tableName)

public DataTable(ResultSet resultSet, String tableName)

Creates an object by wrapping the specified ResultSet.

Parameters:

ParameterTypeDescription
resultSetjava.sql.ResultSetdata set
tableNamejava.lang.Stringname of the table

acceptChanges()

public void acceptChanges()

Commits all the changes made to this table since the last time acceptChanges() was called.

addEventListener(System.Data.DataTableEventListener listener)

public synchronized void addEventListener(System.Data.DataTableEventListener listener)

Parameters:

ParameterTypeDescription
listenerDataTableEventListener

clearEventListneers()

public synchronized void clearEventListneers()

close()

public void close()

containsColumn(String columnName)

public boolean containsColumn(String columnName)

Check whether the given column exists or not

Parameters:

ParameterTypeDescription
columnNamejava.lang.Stringname of the column

Returns: boolean - true is column can be found by the given columnName

getChildRelations()

public System.Data.DataRelationCollection getChildRelations()

Gets the collection of child relations for this DataTable.

Returns: DataRelationCollection - A DataRelationCollection that contains the child relations for the table. An empty collection is returned if no DataRelation objects exist.

getColumnName(int index)

public String getColumnName(int index)

Analog for .Net DataTable.Columns[i].ColumnName

Parameters:

ParameterTypeDescription
indexint- column’s index

Returns: java.lang.String - column’s name by its index.

getColumns()

public System.Data.DataColumnCollection getColumns()

Gets the collection of columns that belong to this table.

Returns: DataColumnCollection - A DataColumnCollection that contains the collection of DataColumn objects for the table. An empty collection is returned if no DataColumn objects exist.

getColumnsCount()

public int getColumnsCount()

Returns: int - columns count

getConstraints()

public System.Data.ConstraintCollection getConstraints()

Gets the collection of constraints maintained by this table.

Returns: ConstraintCollection - A ConstraintCollection that contains the collection of Constraint objects for the table. An empty collection is returned if no Constraint objects exist.

getDataSet()

public System.Data.DataSet getDataSet()

Gets the DataSet to which this table belongs.

Returns: DataSet - The DataSet to which this table belongs.

getEnforceConstraints()

public boolean getEnforceConstraints()

Returns: boolean - flag which indicates whether check constraint violation or not

getNamespace()

public String getNamespace()

Gets the namespace for the XML representation of the data stored in the DataTable.

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

getParentRelations()

public System.Data.DataRelationCollection getParentRelations()

Gets the collection of parent relations for this DataTable.

Returns: DataRelationCollection - A DataRelationCollection that contains the parent relations for the table. An empty collection is returned if no DataRelation objects exist.

getPrimaryKey()

public System.Data.DataColumn[] getPrimaryKey()

Gets an array of columns that function as primary keys for the data table.

Returns: com.aspose.words.net.System.Data.DataColumn[] - An array of DataColumn objects.

getResultSet()

public ResultSet getResultSet()

Returns the underlying Java ResultSet object. Ideally we would like to work with DataTable in .Net manner. But some users and even some ours sample code are using this property.

Returns: java.sql.ResultSet - the underlying java.sql.ResultSet

getRows()

public System.Data.DataRowCollection getRows()

Gets the collection of rows that belong to this table.

Returns: DataRowCollection - A DataRowCollection that contains DataRow objects; otherwise a null value if no DataRow objects exist.

getTableName()

public String getTableName()

Gets the name of the DataTable.

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

newRow()

public System.Data.DataRow newRow()

Creates a new DataRow with the same schema as the table.

Returns: DataRow - A DataRow with the same schema as the DataTable.

onDataColumnDeleted(System.Data.DataColumn column)

public void onDataColumnDeleted(System.Data.DataColumn column)

Update listener when DataColumn Deleted

Parameters:

ParameterTypeDescription
columnDataColumn

onDataColumnInserted(System.Data.DataColumn column)

public void onDataColumnInserted(System.Data.DataColumn column)

Update listener when DataColumn Inserted

Parameters:

ParameterTypeDescription
columnDataColumn

onDataRowChanged(System.Data.DataRow row)

public void onDataRowChanged(System.Data.DataRow row)

Update listener when DataRow Changed

Parameters:

ParameterTypeDescription
rowDataRow

onDataRowDeleted(System.Data.DataRow row)

public void onDataRowDeleted(System.Data.DataRow row)

Update listener when DataRow Deleted

Parameters:

ParameterTypeDescription
rowDataRow

onDataRowInserted(System.Data.DataRow row)

public void onDataRowInserted(System.Data.DataRow row)

Update listener when DataRow Inserted

Parameters:

ParameterTypeDescription
rowDataRow

refresh()

public void refresh()

Reloads all the data from ResultSet if it is present.

setEnforceConstraints(boolean enforceConstraints)

public void setEnforceConstraints(boolean enforceConstraints)

Parameters:

ParameterTypeDescription
enforceConstraintsbooleanis the flag which indicates whether check constraint violation or not

setNamespace(String value)

public void setNamespace(String value)

Sets the namespace for the XML representation of the data stored in the DataTable.

Parameters:

ParameterTypeDescription
valuejava.lang.StringThe namespace of the DataTable.

setPrimaryKey(System.Data.DataColumn[] value)

public void setPrimaryKey(System.Data.DataColumn[] value)

Sets an array of columns that function as primary keys for the data table.

Parameters:

ParameterTypeDescription
valueDataColumn[]An array of DataColumn objects.

setTableName(String value)

public void setTableName(String value)

Sets the name of the DataTable.

Parameters:

ParameterTypeDescription
valuejava.lang.StringThe name of the DataTable.