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:Parameters:rowNumber: The row number.
columnName: The name of the column.
Return ValueThe 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: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 ValueThe 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:Parameters:rowNumber: The row number.
columnName: The name of the column.
Return ValueThe 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: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 ValueThe 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