本文整理汇总了C#中System.Data.DataColumn.First方法的典型用法代码示例。如果您正苦于以下问题:C# DataColumn.First方法的具体用法?C# DataColumn.First怎么用?C# DataColumn.First使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Data.DataColumn
的用法示例。
在下文中一共展示了DataColumn.First方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExportJoins
//.........这里部分代码省略.........
// Get the list of columns for the lookup table.
DataColumn[] lutColumns = new DataColumn[lutRelation.ParentTable.Columns.Count];
lutRelation.ParentTable.Columns.CopyTo(lutColumns, 0);
// If the lookup table contains the required field name.
if (lutRelation.ParentTable.Columns.Contains(lutFieldName))
{
//---------------------------------------------------------------------
// CHANGED: CR15 (Concatenate IHS codes and descriptions)
// Enable users to specify if individual fields should be
// exported with both codes and descriptions concatenated
// together.
//
// If both the original field and it's corresponding lookup
// table field are required then add them both to the sql
// target list.
if ((fieldFormat != null) && (fieldFormat.ToLower() == "both"))
{
// Add the corresponding lookup table field to the sql
// target list.
targetList.Append(String.Format(",{0}.{1} {5} {6} {5} {2}.{3} AS {4}",
currTable,
_viewModelMain.DataBase.QuoteIdentifier(r.column_name),
parentTableAlias,
_viewModelMain.DataBase.QuoteIdentifier(lutFieldName),
r.field_name.Replace("<no>", ""),
_viewModelMain.DataBase.ConcatenateOperator,
_viewModelMain.DataBase.QuoteValue(" : ")));
// Set the field length of the export field to the source
// field length plus the lookup table field length plus 3
// for the concatenation string length.
fieldLength += lutColumns.First(c => c.ColumnName == lutFieldName).MaxLength + 3;
}
//---------------------------------------------------------------------
else
{
// Add the corresponding lookup table field to the sql
// target list.
targetList.Append(String.Format(",{0}.{1} AS {2}",
parentTableAlias,
_viewModelMain.DataBase.QuoteIdentifier(lutFieldName),
r.field_name.Replace("<no>", "")));
// Set the field length of the lookup table field.
fieldLength = lutColumns.First(c => c.ColumnName == lutFieldName).MaxLength;
}
//---------------------------------------------------------------------
// FIX: 044 Enable text field lengths to be specified in
// the export format.
//
// Override the source field length(s) if an export
// field length has been set.
if (!r.IsNull(_viewModelMain.HluDataset.exports_fields.field_lengthColumn) &&
r.field_length > 0)
fieldLength = r.field_length;
//---------------------------------------------------------------------
// Add the field to the sql list of export table columns.
AddExportColumn(multipleFields ? r.fields_count : 0, r.table_name, r.column_name, r.field_name,
r.field_type, fieldLength, !r.IsNull(_viewModelMain.HluDataset.exports_fields.field_formatColumn) ? r.field_format : String.Empty,
ref exportFields);
}
// If the lookup table does not contains the required field