DhODBCTable Class

DhODBCTable Class

This Package | All Packages

DhTable
  |
  +--DhODBCTable
public class DhODBCTable
extends DhTable

Represents an HTML table that can be populated with data from any ODBC data source. This table works on the server or on the client.

Constructors
Name Description
DhODBCTable() Creates a DhODBCTable object.
DhODBCTable( String strConnection, String strSQL, dhRow repeaterRow ) Creates a DhODBCTable object.

Methods
Name Description
close() Closes the record set and the connection to the data source.
execute( String strCommand ) Runs the specified command string query on the database indicated by the connection string.
execute( String strCommand, int options ) Runs the specified command string query on the database indicated by the connection string.
getAutoHeader( ) Retrieves the current header generation mode.
getConnectionString() Retrieves the connection string and query string that will be used to create the table.
getRangeEnd() Retrieves the end of the current record range.
getRangeStart() Retrieves the beginning of the current record range.
getSQL() Retrieves the query string that will be used to create the table.
onColumnData( String strColName, String strColData, Object srcField ) Retrieves column values for fields in the underlying data table.
open() Connects to the data source and creates a new recordset.
setAutoHeader( boolean fAuto ) Enables or disables automatic generation of column headings.
setConnectionString( String strConnection ) Sets the connection string and query string that will be used to create the table.
setPageSize( int nPageSize ) Sets the number of records to be displayed per page.
setRecordRange( int nStartRecord, int nEndRecord ) Sets the range of records that will be displayed in the table.
setSQL( String strSQL, DhRow repeaterRow ) Sets the query string that will be used to create the table.
showNextPage() Displays the next page of data in the table.
showPreviousPage() Displays the previous page of data in the table.

Constructors

DhODBCTable.DhODBCTable

Syntax 1
public DhODBCTable();
Description

Creates a DhODBCTable object. This is the default constructor.



Syntax 2
public DhODBCTable( String strConnection, String strSQL, dhRow repeaterRow );
Parameters
strConnection
The connection string in the form. "DSN=data source name;DATABASE=database;UID=user id;PWD=password"
strSQL
The SQL query to run.
repeaterRow
A row containing the data fields and format that you want repeated for each record.
Description

Creates a DhODBCTable object. This constructor inititalizes the connection string and query string that will be used to create the table.

Methods

DhODBCTable.close

Syntax
public void close();
Description

Closes the record set and the connection to the data source.

See Also
open

DhODBCTable.execute

Syntax 1
public boolean execute( String strCommand );
Parameters
strCommand
The command string.
Return Value

Returns true if the command was successful; otherwise, returns false.

Description

Runs the specified command string query on the database indicated by the connection string.

See Also
setConnectionString



Syntax 2
public boolean execute( String strCommand, int options );
Parameters
strCommand
The command string.
options
The context of strCommand, which can be one of the following:
  • 1 - strCommand is a textual command.
  • 2 - strCommand is a table name.
  • 4 - strCommand is a call to a stored procedure.
  • 8 - strCommand is of an unknown type (default).

.

Return Value

Returns true if the command was successful; otherwise, returns false.

Description

Runs the specified command string query on the database indicated by the connection string.

See Also
setConnectionString

DhODBCTable.getAutoHeader

Syntax
public boolean getAutoHeader( );
Return Value

Returns true if a header row will be created; otherwise, returns false.

Description

Retrieves the current header generation mode.

See Also
setAutoHeader

DhODBCTable.getConnectionString

Syntax
public String getConnectionString();
Return Value

Returns the connection string.

Description

Retrieves the connection string and query string that will be used to create the table.

See Also
setConnectionString

DhODBCTable.getRangeEnd

Syntax
public int getRangeEnd();
Return Value

Returns the end of the record range. The default is -1, indicating records will be displayed until the end of the recordset.

Description

Retrieves the end of the current record range.

See Also
setRecordRange

DhODBCTable.getRangeStart

Syntax
public int getRangeStart();
Return Value

Returns the beginning of the record range. The default is 0.

Description

Retrieves the beginning of the current record range.

See Also
setRecordRange

DhODBCTable.getSQL

Syntax
public String getSQL();
Return Value

Returns the SQL query string to retrieve the data.

Description

Retrieves the query string that will be used to create the table.

DhODBCTable.onColumnData

Syntax
public String onColumnData( String strColName, String strColData, Object srcField );
Parameters
strColName
The column name.
strColData
The default string representation of the column data.
srcField
A reference to the underlying com.ms.ado.Field object.
Return Value

Returns the desired field string value.

Description

Retrieves column values for fields in the underlying data table. This method will be called by the framework on each field value. Returns the string representation you want to be displayed for that field, or strColData to use the default. You can override this method to provide special handling of column values.

DhODBCTable.open

Syntax
public boolean open();
Return Value

Returns true if the recordset was created successfully; otherwise, returns false.

Description

Connects to the data source and creates a new recordset.

DhODBCTable.setAutoHeader

Syntax
public void setAutoHeader( boolean fAuto );
Parameters
fAuto
Set to true to generate header rows; set to false to disable automatic generation.
Description

Enables or disables automatic generation of column headings. If enabled, a heading row with the column names is automatically added to the table when it is generated.

DhODBCTable.setConnectionString

Syntax
public void setConnectionString( String strConnection );
Parameters
strConnection
The connection string in the form "DSN=data source name;DATABASE=database;UID=user id;PWD=password".
Description

Sets the connection string and query string that will be used to create the table.

DhODBCTable.setPageSize

Syntax
public void setPageSize( int nPageSize );
Parameters
nPageSize
The number of records to display per page.
Description

Sets the number of records to be displayed per page.

See Also
showNextPage, showPreviousPage

DhODBCTable.setRecordRange

Syntax
public void setRecordRange( int nStartRecord, int nEndRecord );
Parameters
nStartRecord
The first record to display.
nEndRecord
The last record to display.
Description

Sets the range of records that will be displayed in the table. These numbers reflect absolute, zero-based record positions.

DhODBCTable.setSQL

Syntax
public void setSQL( String strSQL, DhRow repeaterRow );
Parameters
strQuery
The SQL query string to retrieve the data.
repeaterRow
A row containing the data fields and format that you want repeated for each record.
Description

Sets the query string that will be used to create the table. If the requested query is different from the current query and a connection is open, the new query is run immediately.

DhODBCTable.showNextPage

Syntax
public void showNextPage();
Description

Displays the next page of data in the table. This method updates the record range start and end properties.

See Also
setPageSize, setRecordRange

DhODBCTable.showPreviousPage

Syntax
public void showPreviousPage();
Description

Displays the previous page of data in the table. This method updates the record range start and end properties.

See Also
setPageSize, setRecordRange