當前位置: 首頁>>代碼示例>>C#>>正文


C# DataColumn.First方法代碼示例

本文整理匯總了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
開發者ID:HabitatFramework,項目名稱:HLUTool,代碼行數:67,代碼來源:ViewModelWindowMainExport.cs


注:本文中的System.Data.DataColumn.First方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。