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:
Parameter
Type
Description
tableName
java.lang.String
name of the table
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:
Parameter
Type
Description
resultSet
java.sql.ResultSet
data set
DataTable(ResultSet resultSet, String tableName)
public DataTable(ResultSet resultSet, String tableName)
Creates an object by wrapping the specified ResultSet.
Parameters:
Parameter
Type
Description
resultSet
java.sql.ResultSet
data set
tableName
java.lang.String
name of the table
close()
public void close()
This method is not used in real life.
getTableName()
public String getTableName()
Gets the name of the DataTable.
Returns:
java.lang.String - the name of the DataTable.
setTableName(String tableName)
public void setTableName(String tableName)
Sets the name of the DataTable.
Parameters:
Parameter
Type
Description
tableName
java.lang.String
name of the table
getColumnsCount()
public int getColumnsCount()
Returns:
int - columns count
getColumnName(int index)
public String getColumnName(int index)
Analog for .Net DataTable.Columns[i].ColumnName
Parameters:
Parameter
Type
Description
index
int
- column’s index
Returns:
java.lang.String - column’s name by its index.
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 ResultSet
getDataSet()
public DataSet getDataSet()
Returns:DataSet - the DataSet to which this table belongs.
getChildRelations()
public 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.
getParentRelations()
public 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.
getRows()
public 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.
getColumns()
public 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.
newRow()
public DataRow newRow()
Creates a new DataRow with the same schema as the table.
Returns:DataRow - A DataRow with the same schema as the DataTable.
getConstraints()
public 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.
getPrimaryKey()
public DataColumn[] getPrimaryKey()
Gets an array of columns that function as primary keys for the data table.
Returns:
com.groupdocs.assembly.system.data.DataColumn[] - An array of DataColumn objects.
setPrimaryKey(DataColumn[] value)
public void setPrimaryKey(DataColumn[] value)
Sets an array of columns that function as primary keys for the data table.