Codecore Logo
Quick Search
»
Advanced Search »

DataTable Object

RSS
Represents one table of in-memory data retrieved from a database using an OleDbConnection or OdbcConnection instance.


Instance Properties

RowCount

Gets the number of rows in the DataTable.

Accessibility : Read Only

Type: Number

Instance Methods

GetFieldString ( Number, String )

Retrieves a value from the DataTable at the specified row and column as a String.

Syntax:

String GetFieldString(Number rowNumber, String columnName )

Parameters:

rowNumber: The row number.

columnName: The name of the column.

Return Value

The value at the specified row and column as a String.

Example:


dt = db.GetDataTable("select * from mytable");
s = dt.GetFieldString(0, "col1");

GetFieldString ( Number, String, String )

Retrieves a value from the DataTable at the specified row and column as a String. If the value is null, then the specified default value is returned.

Syntax:

String GetFieldString(Number rowNumber, String columnName, String defaultValue )

Parameters:

rowNumber: The row number.

columnName: The name of the column.

defaultValue: The value to return if the specified row/column value is null.

Return Value

The value at the specified row and column as a String.

Example:


dt = db.GetDataTable("select * from mytable");
s = dt.GetFieldString(0, "col1", "myvalue");

GetFieldNumber ( Number, String )

Retrieves a value from the DataTable at the specified row and column as a Number.

Syntax:

Number GetFieldNumber(Number rowNumber, String columnName )

Parameters:

rowNumber: The row number.

columnName: The name of the column.

Return Value

The value at the specified row and column as a Number.

Example:


dt = db.GetDataTable("select * from mytable");
n = dt.GetFieldNumber(0, "col2");

GetFieldNumber ( Number, String, Number )

Retrieves a value from the DataTable at the specified row and column as a Number. If the value is null, then the specified default value is returned.

Syntax:

Number GetFieldString(Number rowNumber, String columnName, Number defaultValue )

Parameters:

rowNumber: The row number.

columnName: The name of the column.

defaultValue: The value to return if the specified row/column value is null.

Return Value

The value at the specified row and column as a Number.

Example:


dt = db.GetDataTable("select * from mytable");
s = dt.GetFieldNumber(0, "col2", 0);

See Also

Scripting Language
OleDbConnection Object
OdbcConnection Object
Privacy Policy | Conditions Of Use

Copyright ©2014 Codecore Technologies, All rights reserved.