Table of Contents

Class DataRowExtensions

Namespace
Tripous.Data
Assembly
Tripous.Data.dll

A helper class for returning typed values from a DataRow in a safe manner

public static class DataRowExtensions
Inheritance
DataRowExtensions
Inherited Members

Methods

AppendTo(DataRow, DataTable)

Copies, using a safe copy, and appends Source DataRow to DestTable

public static DataRow AppendTo(this DataRow Source, DataTable DestTable)

Parameters

Source DataRow
DestTable DataTable

Returns

DataRow

AsBoolean(DataRow, int)

Returns the value of the field by ColumnIndex of row, if any, else Default.

public static bool AsBoolean(this DataRow row, int ColumnIndex)

Parameters

row DataRow
ColumnIndex int

Returns

bool

AsBoolean(DataRow, int, bool)

Returns the value of the field by ColumnIndex of row, if any, else Default.

public static bool AsBoolean(this DataRow row, int ColumnIndex, bool Default)

Parameters

row DataRow
ColumnIndex int
Default bool

Returns

bool

AsBoolean(DataRow, string)

Returns the value of the field by ColumnName of row, if any, else Default.

public static bool AsBoolean(this DataRow row, string ColumnName)

Parameters

row DataRow
ColumnName string

Returns

bool

AsBoolean(DataRow, string, bool)

Returns the value of the field by ColumnName of row, if any, else Default.

public static bool AsBoolean(this DataRow row, string ColumnName, bool Default)

Parameters

row DataRow
ColumnName string
Default bool

Returns

bool

AsDateTime(DataRow, int)

Returns the value of the field by ColumnIndex of row, if any, else Default.

public static DateTime AsDateTime(this DataRow row, int ColumnIndex)

Parameters

row DataRow
ColumnIndex int

Returns

DateTime

AsDateTime(DataRow, int, DateTime)

Returns the value of the field by ColumnIndex of row, if any, else Default.

public static DateTime AsDateTime(this DataRow row, int ColumnIndex, DateTime Default)

Parameters

row DataRow
ColumnIndex int
Default DateTime

Returns

DateTime

AsDateTime(DataRow, string)

Returns the value of the field by ColumnName of row, if any, else Default.

public static DateTime AsDateTime(this DataRow row, string ColumnName)

Parameters

row DataRow
ColumnName string

Returns

DateTime

AsDateTime(DataRow, string, DateTime)

Returns the value of the field by ColumnName of row, if any, else Default.

public static DateTime AsDateTime(this DataRow row, string ColumnName, DateTime Default)

Parameters

row DataRow
ColumnName string
Default DateTime

Returns

DateTime

AsDecimal(DataRow, int)

Returns the value of the field by ColumnIndex of row, if any, else Default.

public static decimal AsDecimal(this DataRow row, int ColumnIndex)

Parameters

row DataRow
ColumnIndex int

Returns

decimal

AsDecimal(DataRow, int, decimal)

Returns the value of the field by ColumnName of row, if any, else Default.

public static decimal AsDecimal(this DataRow row, int ColumnIndex, decimal Default)

Parameters

row DataRow
ColumnIndex int
Default decimal

Returns

decimal

AsDecimal(DataRow, string)

Returns the value of the field by ColumnName of row, if any, else Default.

public static decimal AsDecimal(this DataRow row, string ColumnName)

Parameters

row DataRow
ColumnName string

Returns

decimal

AsDecimal(DataRow, string, decimal)

Returns the value of the field by ColumnName of row, if any, else Default.

public static decimal AsDecimal(this DataRow row, string ColumnName, decimal Default)

Parameters

row DataRow
ColumnName string
Default decimal

Returns

decimal

AsDouble(DataRow, int)

Returns the value of the field by ColumnIndex of row, if any, else Default.

public static double AsDouble(this DataRow row, int ColumnIndex)

Parameters

row DataRow
ColumnIndex int

Returns

double

AsDouble(DataRow, int, double)

Returns the value of the field by ColumnName of row, if any, else Default.

public static double AsDouble(this DataRow row, int ColumnIndex, double Default)

Parameters

row DataRow
ColumnIndex int
Default double

Returns

double

AsDouble(DataRow, string)

Returns the value of the field by ColumnName of row, if any, else Default.

public static double AsDouble(this DataRow row, string ColumnName)

Parameters

row DataRow
ColumnName string

Returns

double

AsDouble(DataRow, string, double)

Returns the value of the field by ColumnName of row, if any, else Default.

public static double AsDouble(this DataRow row, string ColumnName, double Default)

Parameters

row DataRow
ColumnName string
Default double

Returns

double

AsInteger(DataRow, int)

Returns the value of the field by ColumnIndex of row, if any, else Default.

public static int AsInteger(this DataRow row, int ColumnIndex)

Parameters

row DataRow
ColumnIndex int

Returns

int

AsInteger(DataRow, int, int)

Returns the value of the field by ColumnIndex of row, if any, else Default.

public static int AsInteger(this DataRow row, int ColumnIndex, int Default)

Parameters

row DataRow
ColumnIndex int
Default int

Returns

int

AsInteger(DataRow, string)

Returns the value of the field by ColumnName of row, if any, else Default.

public static int AsInteger(this DataRow row, string ColumnName)

Parameters

row DataRow
ColumnName string

Returns

int

AsInteger(DataRow, string, int)

Returns the value of the field by ColumnName of row, if any, else Default.

public static int AsInteger(this DataRow row, string ColumnName, int Default)

Parameters

row DataRow
ColumnName string
Default int

Returns

int

AsObject(DataRow, int, object)

Returns the value of the field by ColumnIndex of row, if any, else Default.

public static object AsObject(this DataRow row, int ColumnIndex, object Default)

Parameters

row DataRow
ColumnIndex int
Default object

Returns

object

AsObject(DataRow, string, object)

Returns the value of the field by ColumnName of row, if any, else Default.

public static object AsObject(this DataRow row, string ColumnName, object Default)

Parameters

row DataRow
ColumnName string
Default object

Returns

object

AsString(DataRow, int)

Returns the value of the field by ColumnIndex of row, if any, else Default.

public static string AsString(this DataRow row, int ColumnIndex)

Parameters

row DataRow
ColumnIndex int

Returns

string

AsString(DataRow, int, string)

Returns the value of the field by ColumnIndex of row, if any, else Default.

public static string AsString(this DataRow row, int ColumnIndex, string Default)

Parameters

row DataRow
ColumnIndex int
Default string

Returns

string

AsString(DataRow, string)

Returns the value of the field by ColumnName of row, if any, else Default.

public static string AsString(this DataRow row, string ColumnName)

Parameters

row DataRow
ColumnName string

Returns

string

AsString(DataRow, string, string)

Returns the value of the field by ColumnName of row, if any, else Default.

public static string AsString(this DataRow row, string ColumnName, string Default)

Parameters

row DataRow
ColumnName string
Default string

Returns

string

BlobToStream(DataRow, string)

If the specified FieldName field is of type byte[] or object, then it returns the field contents as a MemoryStream.

public static MemoryStream BlobToStream(this DataRow Row, string FieldName)

Parameters

Row DataRow
FieldName string

Returns

MemoryStream

BlobToStream(DataRow, string, Stream)

Saves FieldName field of Row, if field is of type byte[] or object, to Stream

public static void BlobToStream(this DataRow Row, string FieldName, Stream Stream)

Parameters

Row DataRow
FieldName string
Stream Stream

BlobToString(DataRow, string)

Reads and returns a string value stored in the BlobFieldName blob field of the specified Row

public static string BlobToString(this DataRow Row, string BlobFieldName)

Parameters

Row DataRow
BlobFieldName string

Returns

string

CopyTo(DataRow, DataRow)

Copies Source to Dest.

WARNING: Assumes that Source and Dest are identical in schema.

WARNING: Dest columns that do not exist in Source remain untouched.

public static void CopyTo(this DataRow Source, DataRow Dest)

Parameters

Source DataRow
Dest DataRow

GetDataRowView(DataRow, DataView)

Returns the DataRowView of the specified DataRow.

public static DataRowView GetDataRowView(this DataRow Row, DataView DataView)

Parameters

Row DataRow
DataView DataView

Returns

DataRowView

LoadFromStream(DataRow, string, Stream)

Loads FieldName field of Row, if field is of type byte[] or object using the content of Stream

public static void LoadFromStream(this DataRow Row, string BlobFieldName, Stream Stream)

Parameters

Row DataRow
BlobFieldName string
Stream Stream

SafeCopyTo(DataRow, DataRow)

Copies Source to Dest.

WARNING: Only data from columns with identical names to both DataRows are copied.

WARNING: Dest columns that do not exist in Source remain untouched.

public static void SafeCopyTo(this DataRow Source, DataRow Dest)

Parameters

Source DataRow
Dest DataRow

SaveToStream(DataRow, string, Stream)

Saves FieldName field of Row, if field is of type byte[] or object, to Stream

public static void SaveToStream(this DataRow Row, string BlobFieldName, Stream Stream)

Parameters

Row DataRow
BlobFieldName string
Stream Stream

SetValue(DataRow, string, object)

Sets a value to the specified field of the specified row in a safe manner, i.e. only if the field exists.

public static bool SetValue(this DataRow Row, string FieldName, object Value)

Parameters

Row DataRow
FieldName string
Value object

Returns

bool

StreamToBlob(DataRow, string, Stream)

Loads FielName field of Row, if field is of type byte[] or object using the content of Stream

public static void StreamToBlob(this DataRow Row, string FieldName, Stream Stream)

Parameters

Row DataRow
FieldName string
Stream Stream

StringToBlob(DataRow, string, string)

Writes Value to the BlobFieldName blob field of the specified Row

public static void StringToBlob(this DataRow Row, string BlobFieldName, string Value)

Parameters

Row DataRow
BlobFieldName string
Value string

TryGetValue(DataRow, string, out object)

Returns the value of a column specified by name and true on success.

public static bool TryGetValue(this DataRow Row, string FieldName, out object Value)

Parameters

Row DataRow
FieldName string
Value object

Returns

bool