Show / Hide Table of Contents

Class DataSetUtilities

A utility class for commmon System.Data.DataSet-related functionallity, that also handles System.DBNull.

Inheritance
Object
DataSetUtilities
Inherited Members
System.Object.ToString()
Object.Equals(Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
Object.MemberwiseClone()
Namespace: IRM.Data
Assembly: IRM.dll
Syntax
public static class DataSetUtilities
Remarks

Eric Quist Stable

Methods

BuildErrorMessageFromDataSet(DataSet, Boolean)

Builds an error message with the following structure: [The table TableName contains the following errors:] Row number '1' contains the following errors: [RowError] [ - ColumnName: ColumnError] [ - ColumnName: ColumnError] [The table TableName contains the following errors:] Row number '1' contains the following errors: [RowError] [ - ColumnName: ColumnError] [ - ColumnName: ColumnError]]

Declaration
public static string BuildErrorMessageFromDataSet(DataSet dataSet, bool toHtml)
Parameters
System.Data.DataSet dataSet

A System.Data.DataSet that contains error information.

Boolean toHtml

true if the message should be formatted as HTML; otherwise false.

Returns
String

BuildErrorMessageFromDbCommandInfo(DbCommandInfo, Boolean)

Builds an error message with the following structure:

Declaration
public static string BuildErrorMessageFromDbCommandInfo(DbCommandInfo dbCommandInfo, bool toHtml)
Parameters
DbCommandInfo dbCommandInfo

The DbCommandInfo object that contains information from the System.Data.Common.DbCommand object that was used in the query against the data source.

Boolean toHtml

true if the message should be formatted as HTML; otherwise false.

Returns
String

An error message.

Remarks

The message has the following structure:

DbCommand.CommandText that was used: {0} Parameters: - ParameterName: ParameterValue - ParameterName: ParameterValue

CopyRow(DataRow, DataRow, DataColumn[], DataColumn[], DataRowVersion)

Copies data från sourceRow to destRow using sourceColumns and destColumns as column mapping.

Declaration
public static DataRow CopyRow(DataRow sourceRow, DataRow destRow, DataColumn[] sourceColumns, DataColumn[] destColumns, DataRowVersion sourceRowVersion)
Parameters
DataRow sourceRow

A DataRow containing the source data.

DataRow destRow

A DataRow receiving the copy of data.

System.Data.DataColumn[] sourceColumns

Array of System.Data.DataColumn used for mapping source data.

System.Data.DataColumn[] destColumns

Array of System.Data.DataColumn used for mapping destination data.

System.Data.DataRowVersion sourceRowVersion

The System.Data.DataRowVersion to exctract from source data.

Returns
DataRow

Find<T>(DataTable, DataRowVersion, Object[])

Finds the row identified by values (matching primary key) similar to typed System.Data.DataSet FindXXX() functions. The search is done in the requested System.Data.DataRowVersion of the row.

Declaration
public static T Find<T>(DataTable table, DataRowVersion searchVersion, params object[] values)
    where T : DataRow
Parameters
System.Data.DataTable table

The table to search in.

System.Data.DataRowVersion searchVersion

The DataRowVersion to search for the values in.

Object[] values

Primary key values.

Returns
T

DataRow or null.

Type Parameters
T

Typed DataRow

Exceptions
System.NotImplementedException

Tables with more than one keycolumn are not supported.

GetChanges(DataRow[])

Returns an array of DataRow with changes. Works similar to System.Data.DataTable.GetChanges but with an array of DataRow instead of a System.Data.DataTable and does not return a copy of the rows.

Declaration
public static DataRow[] GetChanges(DataRow[] rows)
Parameters
DataRow[] rows

The DataRows to filter for changes.

Returns
DataRow[]

Array of DataRow.

GetChanges(DataRow[], DataRowState)

Returns an array of DataRow according to specified System.Data.DataRowState. Works similar to System.Data.DataTable.GetChanges(System.Data.DataRowState) but with an array of DataRow instead of a System.Data.DataTable and does not return a copy of the rows.

Declaration
public static DataRow[] GetChanges(DataRow[] rows, DataRowState rowStates)
Parameters
DataRow[] rows

The DataRows to filter for changes.

System.Data.DataRowState rowStates

Returns
DataRow[]

Array of DataRow.

HasChanges(DataTable)

Gets a value indicating wheather the table contains changes.

Declaration
public static bool HasChanges(DataTable table)
Parameters
System.Data.DataTable table

The System.Data.DataTable to check.

Returns
Boolean

true if the table contains changes; otherwise false.

HasNullChanged(DataRow, DataColumn)

Gets a value indicating whether the System.DBNull.Value has changed.

Declaration
public static bool HasNullChanged(DataRow row, DataColumn column)
Parameters
DataRow row

A DataRow that contains information about the row.

System.Data.DataColumn column

A System.Data.DataColumn that contains information about the column.

Returns
Boolean

true if the value has changed; otherwise false.

HasNullChanged(DataRow, String)

Gets a value indicating whether the System.DBNull.Value has changed.

Declaration
public static bool HasNullChanged(DataRow row, string columnName)
Parameters
DataRow row

A DataRow that contains information about the row.

String columnName

The name of the column.

Returns
Boolean

true if the value has changed; otherwise false.

HasValueChanged(DataRow, DataColumn)

Gets a value indicating whether the value has changed.

Declaration
public static bool HasValueChanged(DataRow row, DataColumn column)
Parameters
DataRow row

A DataRow that contains information about the row.

System.Data.DataColumn column

A System.Data.DataColumn that contains information about the column.

Returns
Boolean

true if the value has changed; otherwise false.

HasValueChanged(DataRow, String)

Gets a value indicating whether the value has changed.

Declaration
public static bool HasValueChanged(DataRow row, string columnName)
Parameters
DataRow row

A DataRow that contains information about the row.

String columnName

The name of the column.

Returns
Boolean

true if the value has changed; otherwise false.

IsDifferent(DataRow, DataRow, DataColumn[])

Declaration
public static bool IsDifferent(DataRow a, DataRow b, params DataColumn[] ignoreColumns)
Parameters
DataRow a

DataRow b

System.Data.DataColumn[] ignoreColumns

Returns
Boolean

IsDifferent(DataRow[], DataRow[], DataColumn[])

Declaration
public static bool IsDifferent(DataRow[] a, DataRow[] b, params DataColumn[] ignoreColumns)
Parameters
DataRow[] a

DataRow[] b

System.Data.DataColumn[] ignoreColumns

Returns
Boolean

IsEqual(DataRow, DataRow)

Determines whether all columns in two rows have the same value.

Declaration
public static bool IsEqual(DataRow a, DataRow b)
Parameters
DataRow a

A DataRow that contains information about the row.

DataRow b

A DataRow that contains information about the row.

Returns
Boolean

true if the value of all columns in a is the same as the value of the corrsponding column in b; otherwise false.

Remarks

This method requires that the two rows have the same structure to get a correct result.

IsEqual(DataRow, DataRow, DataColumn[])

Determines whether the columns in two rows have the same value.

Declaration
public static bool IsEqual(DataRow a, DataRow b, params DataColumn[] columns)
Parameters
DataRow a

A DataRow that contains information about the row.

DataRow b

A DataRow that contains information about the row.

System.Data.DataColumn[] columns

A System.Data.DataColumn array containing one or more columns from a.

Returns
Boolean

true if the value of the columns in a is the same as the value of the corrsponding column in b; otherwise false.

Remarks

This method requires that the two rows have the same structure to get a correct result.

Exceptions
ArgumentOutOfRangeException

The array of System.Data.DataColumn was empty.

IsEqual(DataRow, DataRow, DataRowVersion)

Determines whether all columns in two rows have the same value.

Declaration
public static bool IsEqual(DataRow a, DataRow b, DataRowVersion version)
Parameters
DataRow a

A DataRow that contains information about the row.

DataRow b

A DataRow that contains information about the row.

System.Data.DataRowVersion version

System.Data.DataRowVersion that should be used when comparing values.

Returns
Boolean

true if the value of all columns in a is the same as the value of the corrsponding column in b; otherwise false.

Remarks

This method requires that the two rows have the same structure to get a correct result.

IsEqual(DataRow, DataRow, DataRowVersion, DataColumn[])

Determines whether the columns in two rows have the same value.

Declaration
public static bool IsEqual(DataRow a, DataRow b, DataRowVersion version, params DataColumn[] columns)
Parameters
DataRow a

A DataRow that contains information about the row.

DataRow b

A DataRow that contains information about the row.

System.Data.DataRowVersion version

System.Data.DataRowVersion that should be used when comparing values.

System.Data.DataColumn[] columns

A System.Data.DataColumn array containing one or more columns from a.

Returns
Boolean

true if the value of the columns in a is the same as the value of the corrsponding column in b; otherwise false.

Remarks

This method requires that the two rows have the same structure to get a correct result.

Exceptions
ArgumentOutOfRangeException

The array of System.Data.DataColumn was empty.

IsEqual(DataRow, DataRow, DataRowVersion, DataRowVersion)

Determines whether all columns in two rows have the same value.

Declaration
public static bool IsEqual(DataRow a, DataRow b, DataRowVersion versionA, DataRowVersion versionB)
Parameters
DataRow a

A DataRow that contains information about the row.

DataRow b

A DataRow that contains information about the row.

System.Data.DataRowVersion versionA

System.Data.DataRowVersion that should be used when comparing values from a.

System.Data.DataRowVersion versionB

System.Data.DataRowVersion that should be used when comparing values from b.

Returns
Boolean

true if the value of all columns in a is the same as the value of the corrsponding column in b; otherwise false.

Remarks

This method requires that the two rows have the same structure to get a correct result.

Exceptions
ArgumentOutOfRangeException

If versionA doesn't exists in a.

ArgumentOutOfRangeException

If versionB doesn't exists in b.

IsEqual(DataRow, DataRow, DataRowVersion, DataRowVersion, DataColumn[])

Determines whether the columns in two rows have the same value.

Declaration
public static bool IsEqual(DataRow a, DataRow b, DataRowVersion versionA, DataRowVersion versionB, params DataColumn[] columns)
Parameters
DataRow a

A DataRow that contains information about the row.

DataRow b

A DataRow that contains information about the row.

System.Data.DataRowVersion versionA

System.Data.DataRowVersion that should be used when comparing values in a.

System.Data.DataRowVersion versionB

System.Data.DataRowVersion that should be used when comparing values in b.

System.Data.DataColumn[] columns

A System.Data.DataColumn array containing one or more columns from a.

Returns
Boolean

true if the value of the columns in a is the same as the value of the corrsponding column in b; otherwise false.

Remarks

This method requires that the two rows have the same structure to get a correct result.

Exceptions
ArgumentOutOfRangeException

The array of System.Data.DataColumn was empty.

ArgumentOutOfRangeException

If versionA doesn't exists in a.

ArgumentOutOfRangeException

If versionB doesn't exists in b.

IsEqual(DataRow, DataRow, String[])

Determines whether the columns in two rows have the same value.

Declaration
public static bool IsEqual(DataRow a, DataRow b, params string[] columnNames)
Parameters
DataRow a

A DataRow that contains information about the row.

DataRow b

A DataRow that contains information about the row.

String[] columnNames

An array of column names.

Returns
Boolean

true if the value of the columns in a is the same as the value of the corrsponding column in b; otherwise false.

Remarks

This method requires that the two rows have the same structure to get a correct result.

Exceptions
ArgumentOutOfRangeException

The array of System.Data.DataColumn was empty.

IsEqual(Object, Object)

Determines whether two values have the same value.

Declaration
public static bool IsEqual(object a, object b)
Parameters
Object a

A value.

Object b

A value.

Returns
Boolean

true if the value of a is the same as the value of b; otherwise false.

IsNullOrEmpty(DataRow, DataColumn)

Gets a value indicating whether the value is null or a empty string.

Declaration
public static bool IsNullOrEmpty(DataRow row, DataColumn column)
Parameters
DataRow row

A DataRow that contains information about the row.

System.Data.DataColumn column

A System.Data.DataColumn that contains information about the column.

Returns
Boolean

true if the value is null or a empty string; otherwise false.

IsNullOrEmpty(DataRow, DataColumn, DataRowVersion)

Gets a value indicating whether the value is null or a empty string.

Declaration
public static bool IsNullOrEmpty(DataRow row, DataColumn column, DataRowVersion version)
Parameters
DataRow row

A DataRow that contains information about the row.

System.Data.DataColumn column

A System.Data.DataColumn that contains information about the column.

System.Data.DataRowVersion version

One of the System.Data.DataRowVersion values that specifies the desired row version.

Returns
Boolean

true if the value is null or a empty string; otherwise false.

IsNullOrEmpty(DataRow, String)

Gets a value indicating whether the value is null or a empty string.

Declaration
public static bool IsNullOrEmpty(DataRow row, string columnName)
Parameters
DataRow row

A DataRow that contains information about the row.

String columnName

The name of the column.

Returns
Boolean

true if the value is null or a empty string; otherwise false.

MergeRow(DataRow, DataRow, Boolean)

Merges a specified DataRow into another DataRow.

Declaration
public static void MergeRow(DataRow destinationRow, DataRow sourceRow, bool preserveCurrentChanges)
Parameters
DataRow destinationRow

A DataRow that contains information about the row.

DataRow sourceRow

A DataRow that contains information about the row.

Boolean preserveCurrentChanges

true if the destinationRows current value must be equal to the sourceRows original value; otherwise false.

Remarks

The current value is the proposed value if the DataRowhas a System.Data.DataRowVersion.Proposed, otherwise it is the current value (System.Data.DataRowVersion.Current).

MergeRow(DataTable, DataRow)

Merges a specified DataRow into a System.Data.DataTable.

Declaration
public static void MergeRow(DataTable destinationTable, DataRow sourceRow)
Parameters
System.Data.DataTable destinationTable

A System.Data.DataTable that contains information about the destination table.

DataRow sourceRow

A DataRow that contains information about the row.

MergeRow(DataTable, DataRow, Boolean, Boolean)

Merges a specified DataRow into a System.Data.DataTable.

Declaration
public static void MergeRow(DataTable destinationTable, DataRow sourceRow, bool preserveCurrentChanges, bool recursive)
Parameters
System.Data.DataTable destinationTable

A System.Data.DataTable that contains information about the destination table.

DataRow sourceRow

A DataRow that contains information about the row.

Boolean preserveCurrentChanges

true if the destinationRows current value must be equal to the sourceRows original value; otherwise false.

Boolean recursive

true to merge all the child relation rows; otherwise false.

Remarks

The current value is the proposed value if the DataRowhas a System.Data.DataRowVersion.Proposed, otherwise it is the current value (System.Data.DataRowVersion.Current).

MergeRow(DataTable, DataRow[], Boolean, Boolean)

Merges an array of DataRow into a System.Data.DataTable.

Declaration
public static void MergeRow(DataTable destinationTable, DataRow[] sourceRows, bool preserveCurrentChanges, bool recursive)
Parameters
System.Data.DataTable destinationTable

A System.Data.DataTable that contains information about the destination table.

DataRow[] sourceRows

An array of DataRow objects that contains information about the row.

Boolean preserveCurrentChanges

true if the destinationRows current value must be equal to the sourceRows original value; otherwise false.

Boolean recursive

true to merge all the child relation rows; otherwise false.

Remarks

The current value is the proposed value if the DataRowhas a System.Data.DataRowVersion.Proposed, otherwise it is the current value (System.Data.DataRowVersion.Current).

MergeRowData(DataRow, DataRow, Boolean, DataColumn[])

Merges a specified array of System.Data.DataColumn values of a DataRow into another DataRow.

Declaration
public static void MergeRowData(DataRow destinationRow, DataRow sourceRow, bool preserveCurrentChanges, params DataColumn[] destinationColumns)
Parameters
DataRow destinationRow

A DataRow that contains information about the row.

DataRow sourceRow

A DataRow that contains information about the row.

Boolean preserveCurrentChanges

true if the destinationRows current value must be equal to the sourceRows original value; otherwise false.

System.Data.DataColumn[] destinationColumns

An array of System.Data.DataColumn that contains information about the columns.

Remarks

The current value is the proposed value if the DataRowhas a System.Data.DataRowVersion.Proposed, otherwise it is the current value (System.Data.DataRowVersion.Current).

MergeRowData(DataRow, DataRow, Boolean, String[])

Merges a specified array of System.Data.DataColumn values of a DataRow into another DataRow.

Declaration
public static void MergeRowData(DataRow destinationRow, DataRow sourceRow, bool preserveCurrentChanges, params string[] destinationColumnNames)
Parameters
DataRow destinationRow

A DataRow that contains information about the row.

DataRow sourceRow

A DataRow that contains information about the row.

Boolean preserveCurrentChanges

true if the destinationRows current value must be equal to the sourceRows original value; otherwise false.

String[] destinationColumnNames

An array of column names.

Remarks

The current value is the proposed value if the DataRowhas a System.Data.DataRowVersion.Proposed, otherwise it is the current value (System.Data.DataRowVersion.Current).

Select<T>(T, String)

Same basic functionality as System.Data.DataTable.Select, but returns a strongly typed System.Data.DataTable instead of an array of DataRow.

Declaration
public static T Select<T>(T table, string filter)
    where T : DataTable
Parameters
T table

The System.Data.DataTable of in-memory data to search in.

String filter

The criteria to use to filter the rows.

Returns
T

The selected DataRows in a stronly typed DataTable. If no DataRows match, an empty DataTable is returned.

Type Parameters
T

Specific derived System.Data.DataTable type.

Select<T>(T, String, String)

Same basic functionality as System.Data.DataTable.Select, but returns a strongly typed System.Data.DataTable instead of an array of DataRow.

Declaration
public static T Select<T>(T table, string filter, string sort)
    where T : DataTable
Parameters
T table

The System.Data.DataTable of in-memory data to search in.

String filter

The criteria to use to filter the rows.

String sort

Sorting expression to sort rows.

Returns
T

The selected DataRows in a stronly typed DataTable. If no DataRows match, an empty DataTable is returned.

Type Parameters
T

Specific derived System.Data.DataTable type.

Select<T>(T, String, String, Int32)

Same basic functionality as System.Data.DataTable.Select, but returns a strongly typed System.Data.DataTable instead of an array of DataRow. Returns maxNumberOfRecords or all records if less then maxNumberOfRecords.

Declaration
public static T Select<T>(T table, string filter, string sort, int maxNumberOfRecords)
    where T : DataTable
Parameters
T table

The System.Data.DataTable of in-memory data to search in.

String filter

The criteria to use to filter the rows.

String sort

Sorting expression to sort rows.

System.Int32 maxNumberOfRecords

The maximum number of records to return.

Returns
T

The selected DataRows in a stronly typed DataTable. If no DataRows match, an empty DataTable is returned.

Type Parameters
T

Specific derived System.Data.DataTable type.

SelectDistinct(DataTable, DataTable, DataColumn[])

Gets a new System.Data.DataTable with only the distinct rows.

Declaration
public static DataTable SelectDistinct(DataTable sourceTable, DataTable destinationTable, params DataColumn[] columns)
Parameters
System.Data.DataTable sourceTable

The System.Data.DataTable that shoud be used as source.

System.Data.DataTable destinationTable

The System.Data.DataTable that should be used as destination.

System.Data.DataColumn[] columns

A System.Data.DataColumn array containing one ore more columns that should be used for distinction.

Returns
System.Data.DataTable

The destinationTable, but only with the distinct rows.

Remarks

The System.Data.DataColumn in columns array must be from the sourceTable.

Exceptions
ArgumentOutOfRangeException

The columns is empty.

-or-

The destinationTable does not contain a one of the columns.

SelectDistinct(DataTable, DataTable, String[])

Gets a new System.Data.DataTable with only the distinct rows.

Declaration
public static DataTable SelectDistinct(DataTable sourceTable, DataTable destinationTable, params string[] columnNames)
Parameters
System.Data.DataTable sourceTable

The System.Data.DataTable that shoud be used as source.

System.Data.DataTable destinationTable

The System.Data.DataTable that should be used as destination.

String[] columnNames

A String array containing one ore more column names that should be used for distinction.

Returns
System.Data.DataTable

The destinationTable, but only with the distinct rows.

Exceptions
ArgumentOutOfRangeException

The columnNames is empty.

-or-

The sourceTable or the destinationTable does not contain a one of the columns.

SelectDistinct(DataTable, String[])

Gets a new System.Data.DataTable with only the distinct rows.

Declaration
public static DataTable SelectDistinct(DataTable sourceTable, params string[] columnNames)
Parameters
System.Data.DataTable sourceTable

The System.Data.DataTable that shoud be used as source.

String[] columnNames

A String array containing one ore more column names that should be used for distinction.

Returns
System.Data.DataTable

A new System.Data.DataTable with the same schema as the sourceTable, but only with the distinct rows.

Exceptions
ArgumentOutOfRangeException

The columnNames is empty.

-or-

The sourceTable or the destinationTable does not contain a one of the columns.

SelectDistinct(String, DataTable, DataTable, DataColumn[])

Gets a new System.Data.DataTable with only the distinct rows.

Declaration
public static DataTable SelectDistinct(string sourceFilter, DataTable sourceTable, DataTable destinationTable, params DataColumn[] columns)
Parameters
String sourceFilter

The criteria to use to filter the rows.

System.Data.DataTable sourceTable

The System.Data.DataTable that shoud be used as source.

System.Data.DataTable destinationTable

The System.Data.DataTable that should be used as destination.

System.Data.DataColumn[] columns

A System.Data.DataColumn array containing one ore more columns that should be used for distinction.

Returns
System.Data.DataTable

The destinationTable, but only with the distinct rows.

Remarks

The System.Data.DataColumn in columns array must be from the sourceTable.

Exceptions
ArgumentOutOfRangeException

The columns is empty.

-or-

The destinationTable does not contain a one of the columns.

SelectDistinct(String, DataTable, DataTable, String[])

Gets a new System.Data.DataTable with only the distinct rows.

Declaration
public static DataTable SelectDistinct(string sourceFilter, DataTable sourceTable, DataTable destinationTable, params string[] columnNames)
Parameters
String sourceFilter

The criteria to use to filter the rows.

System.Data.DataTable sourceTable

The System.Data.DataTable that shoud be used as source.

System.Data.DataTable destinationTable

The System.Data.DataTable that should be used as destination.

String[] columnNames

A String array containing one ore more column names that should be used for distinction.

Returns
System.Data.DataTable

The destinationTable, but only with the distinct rows.

Exceptions
ArgumentOutOfRangeException

The columnNames is empty.

-or-

The sourceTable or the destinationTable does not contain a one of the columns.

SelectDistinct(String, DataTable, String[])

Gets a new System.Data.DataTable with only the distinct rows.

Declaration
public static DataTable SelectDistinct(string sourceFilter, DataTable sourceTable, params string[] columnNames)
Parameters
String sourceFilter

The criteria to use to filter the rows.

System.Data.DataTable sourceTable

The System.Data.DataTable that shoud be used as source.

String[] columnNames

A String array containing one ore more column names that should be used for distinction.

Returns
System.Data.DataTable

A new System.Data.DataTable with the same schema as the sourceTable, but only with the distinct rows.

Exceptions
ArgumentOutOfRangeException

The columnNames is empty.

-or-

The sourceTable or the destinationTable does not contain a one of the columns.

SelectSingleRow(DataTable, String)

Gets the first DataRow object that matches the filter criteria in order of the primary key (or lacking one, order of addition).

Declaration
public static DataRow SelectSingleRow(DataTable table, string filter)
Parameters
System.Data.DataTable table

The System.Data.DataTable of in-memory data to search in.

String filter

The criteria to use to filter the rows.

Returns
DataRow

The first DataRow or null (Nothing in Visual Basic) if no row matches the criteria.

SelectSingleRow<T>(DataTable, String)

Gets the first typed DataRow object that matches the filter criteria in order of the primary key (or lacking one, order of addition).

Declaration
public static T SelectSingleRow<T>(DataTable table, string filter)
    where T : DataRow
Parameters
System.Data.DataTable table

The System.Data.DataTable of in-memory data to search in.

String filter

The criteria to use to filter the rows.

Returns
T

The first DataRow or null (Nothing in Visual Basic) if no row matches the criteria.

Type Parameters
T

SelectSingleRow<T>(DataTable, String, DataViewRowState)

Gets the first typed DataRow object that matches the filter criteria and the specified state in order of the primary key (or lacking one, order of addition).

Declaration
public static T SelectSingleRow<T>(DataTable table, string filter, DataViewRowState recordState)
    where T : DataRow
Parameters
System.Data.DataTable table

The System.Data.DataTable of in-memory data to search in.

String filter

The criteria to use to filter the rows.

DataViewRowState recordState

One of the DataViewRowState values.

Returns
T

The first DataRow or null (Nothing in Visual Basic) if no row matches the criteria.

Type Parameters
T

SetValueIf(Boolean, DataRow, DataColumn, Object)

Sets the value if a condition is true.

Declaration
public static void SetValueIf(bool condition, DataRow row, DataColumn column, object newValue)
Parameters
Boolean condition

true to cause a value to be changed; otherwise false.

DataRow row

A DataRow that contains information about the row.

System.Data.DataColumn column

A System.Data.DataColumn that contains information about the column.

Object newValue

The new value to set on the row if it is different.

SetValueIfCurrentIsEqual(Object, DataRow, DataColumn, Object)

Changes the value of the row if the value of the row is equal to the current value.

Declaration
public static bool SetValueIfCurrentIsEqual(object currentValue, DataRow row, DataColumn column, object newValue)
Parameters
Object currentValue

The current value to check for on the row.

DataRow row

A DataRow that contains information about the row.

System.Data.DataColumn column

A System.Data.DataColumn that contains information about the column.

Object newValue

The new value to set on the row if the current value of the row is equal to currentValue.

Returns
Boolean

true if the value has changed; otherwise false.

SetValueIfCurrentIsEqual(Object, DataRow, String, Object)

Changes the value of the row if the value of the row is equal to the current value.

Declaration
public static bool SetValueIfCurrentIsEqual(object currentValue, DataRow row, string columnName, object newValue)
Parameters
Object currentValue

The current value to check for on the row.

DataRow row

A DataRow that contains information about the row.

String columnName

The name of the column.

Object newValue

The new value to set on the row if the current value of the row is equal to currentValue.

Returns
Boolean

true if the value has changed; otherwise false.

SetValueIfDifferent(DataRow, DataColumn, Object)

Changes the value if the new value are different from the current value.

Declaration
public static bool SetValueIfDifferent(DataRow row, DataColumn column, object newValue)
Parameters
DataRow row

A DataRow that contains information about the row.

System.Data.DataColumn column

A System.Data.DataColumn that contains information about the column.

Object newValue

The new value to set on the row if it is different.

Returns
Boolean

true if the value has changed; otherwise false.

SetValueIfDifferent(DataRow, DataColumn, Object, Boolean)

Changes the value if the new value are different from the current value.

Declaration
public static bool SetValueIfDifferent(DataRow row, DataColumn column, object newValue, bool ignoreCase)
Parameters
DataRow row

A DataRow that contains information about the row.

System.Data.DataColumn column

A System.Data.DataColumn that contains information about the column.

Object newValue

The new value to set on the row if it is different.

Boolean ignoreCase

Indicates whether casing should be honored.

Returns
Boolean

true if the value has changed; otherwise false.

SetValueIfDifferent(DataRow, String, Object)

Changes the value if the value are different from the current value.

Declaration
public static bool SetValueIfDifferent(DataRow row, string columnName, object newValue)
Parameters
DataRow row

A DataRow that contains information about the row.

String columnName

The name of the column.

Object newValue

The new value to set on the row if it is different.

Returns
Boolean

true if the value has changed; otherwise false.

SetValueIfDifferent(DataRow, String, Object, Boolean)

Changes the value if the value are different from the current value.

Declaration
public static bool SetValueIfDifferent(DataRow row, string columnName, object newValue, bool ignoreCase)
Parameters
DataRow row

A DataRow that contains information about the row.

String columnName

The name of the column.

Object newValue

The new value to set on the row if it is different.

Boolean ignoreCase

Indicates whether casing should be honored.

Returns
Boolean

true if the value has changed; otherwise false.

SetValueIfDifferent(Object, DataRow, DataColumn, Object)

Changes the value if the row's current value equals a current value.

Declaration
public static bool SetValueIfDifferent(object currentValue, DataRow row, DataColumn column, object newValue)
Parameters
Object currentValue

The current value to use in the comparision.

DataRow row

A DataRow that contains information about the row.

System.Data.DataColumn column

A System.Data.DataColumn that contains information about the column.

Object newValue

The new value to set on the row if it is different.

Returns
Boolean

true if the value has changed; otherwise false.

SloppyCopyTable(DataTable, DataTable)

Copies rows from source to destination. Only columns found in both source and destination are copied. SloppyCopyTable(DataTable, DataTable) ignores datatype diffrences. If unable to cast it will fail with an InvalidCastException.

Declaration
public static void SloppyCopyTable(DataTable destination, DataTable source)
Parameters
System.Data.DataTable destination

Destination System.Data.DataTable

System.Data.DataTable source

Source System.Data.DataTable

Back to top Generated by DocFX