当前位置: 首页>>代码示例>>C#>>正文


C# DataColumnCollection.Add方法代码示例

本文整理汇总了C#中System.Data.DataColumnCollection.Add方法的典型用法代码示例。如果您正苦于以下问题:C# DataColumnCollection.Add方法的具体用法?C# DataColumnCollection.Add怎么用?C# DataColumnCollection.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Data.DataColumnCollection的用法示例。


在下文中一共展示了DataColumnCollection.Add方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: FilterColumns

 private DataColumn[] FilterColumns(DataTable sourceTable, string[] hiddenColumnNames, DataColumnCollection destinationColumns)
 {
     DataColumn[] columnArray = null;
     int num = 0;
     foreach (DataColumn column3 in sourceTable.Columns)
     {
         if (this.IncludeThisColumn(column3, hiddenColumnNames))
         {
             num++;
         }
     }
     if (num == 0)
     {
         throw ADP.NoColumns();
     }
     int index = 0;
     columnArray = new DataColumn[num];
     foreach (DataColumn column in sourceTable.Columns)
     {
         if (this.IncludeThisColumn(column, hiddenColumnNames))
         {
             DataColumn column2 = new DataColumn(column.ColumnName, column.DataType);
             destinationColumns.Add(column2);
             columnArray[index] = column;
             index++;
         }
     }
     return columnArray;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:29,代码来源:DbMetaDataFactory.cs

示例2: FilterColumns

        private DataColumn[] FilterColumns(DataTable    sourceTable, string[] hiddenColumnNames, DataColumnCollection destinationColumns) {

            DataColumn newDestinationColumn;
            int currentColumn;
            DataColumn[] filteredSourceColumns = null;

            int columnCount = 0;
            foreach (DataColumn sourceColumn in sourceTable.Columns){
                if (IncludeThisColumn(sourceColumn,hiddenColumnNames) == true) {
                    columnCount++;
                }
            }

            if (columnCount == 0)   {
                throw ADP.NoColumns();
            }

            currentColumn= 0;
            filteredSourceColumns = new DataColumn[columnCount];

            foreach(DataColumn sourceColumn in sourceTable.Columns){
                if (IncludeThisColumn(sourceColumn,hiddenColumnNames) == true) {
                    newDestinationColumn    = new DataColumn(sourceColumn.ColumnName,sourceColumn.DataType);
                    destinationColumns.Add(newDestinationColumn);
                    filteredSourceColumns[currentColumn] = sourceColumn;
                    currentColumn++;
                }
            }
            return filteredSourceColumns;
        }
开发者ID:uQr,项目名称:referencesource,代码行数:30,代码来源:DbMetaDataFactory.cs

示例3: InsertAfter

        public void InsertAfter(DataColumnCollection columns, DataColumn currentColumn, DataColumn newColumn)
        {
            if (columns.Contains(currentColumn.ColumnName))
            {
                columns.Add(newColumn);
                //add the new column after the current one 
                columns[newColumn.ColumnName].SetOrdinal(currentColumn.Ordinal + 1);
            }
            else
            {

            }
        }
开发者ID:HarryiCalc,项目名称:Test-Phakisa,代码行数:13,代码来源:scrEngineering.cs

示例4: AddColumn

        /// <summary>
        /// Adds a new <c>DataColumn</c> to the given collection.
        /// </summary>
        /// <remarks>
        /// The new <c>DataColumn</c> is contructed from the remaining
        /// arguments.
        /// </remarks>
        /// <param name="columns">
        /// The collection to which to add the new column.
        /// </param>
        /// <param name="defaultValue">
        /// The new column's default value
        /// </param>
        /// <param name="name">
        /// The name of the new column.  If a column with the same name
        /// pre-exists in the collection, this operation does nothing.
        /// </param>
        /// <param name="type">
        /// The System.Type of the new column's values.
        /// </param>
        internal static void AddColumn(
            DataColumnCollection columns,
            object defaultValue,
            string name,
            Type type)
        {
            if (columns.Contains(name))
            {
                return;
            }

            DataColumn column = new DataColumn(name, type);

            if (defaultValue != null)
            {
                column.DefaultValue = defaultValue;
            }

            columns.Add(column);
        }
开发者ID:plusql,项目名称:hsqldb-snapshot-20160112,代码行数:40,代码来源:HsqlResultSetMetaData.cs

示例5: AddCustomFieldColumns

	private void AddCustomFieldColumns(DataColumnCollection columns)
	{
		var fields = Bitrix.BXCustomEntityManager.GetFields(BXIBlockElement.GetCustomFieldsKey(iblockId));
		foreach (var field in fields)
			columns.Add("#" + field.Name, typeof(BXCustomProperty));
	}
开发者ID:mrscylla,项目名称:volotour.ru,代码行数:6,代码来源:IBlockListAdmin.aspx.cs

示例6: AddColumn

        /// <summary>
        /// Constructs a new <c>DataColumn</c> with the given
        /// <c>name</c>, <c>type</c> and <c>defaultValue</c>,
        /// adding it to the given collection.
        /// </summary>
        /// <param name="columns">
        /// The collection to which to add the new column.
        /// </param>
        /// <param name="defaultValue">
        /// The new column's default value
        /// </param>
        /// <param name="name">
        /// The name of the new column.  If a column with the
        /// same name pre-exists in the collection, this operation
        /// is a no-op.
        /// </param>
        /// <param name="type">
        /// The System.Type of the new column's values.
        /// </param>
        public static void AddColumn(DataColumnCollection columns,
            object defaultValue,
            string name,
            Type type)
        {
            DataColumn column = new DataColumn(name, type);

            if (defaultValue != null)
            {
                column.DefaultValue = defaultValue;
            }

            columns.Add(column);
        }
开发者ID:plusql,项目名称:hsqldb-snapshot-20160112,代码行数:33,代码来源:MetaDataCollection.cs

示例7: Pop

 private uint Pop(CUQueue UQueue, ref DataColumnCollection Cols)
 {
     bool bNull = false;
     uint nSize = UQueue.GetSize();
     UQueue.Load(out bNull);
     if (bNull)
         Cols = null;
     else
     {
         int n;
         int nLen;
         DataColumn dc = null;
         Cols.Clear();
         UQueue.Load(out nLen);
         for (n = 0; n < nLen; n++)
         {
             Pop(UQueue, ref dc);
             Cols.Add(dc);
             dc = null;
         }
     }
     return (nSize - UQueue.GetSize());
 }
开发者ID:udaparts,项目名称:socketpro,代码行数:23,代码来源:remotingadonethelper.cs


注:本文中的System.Data.DataColumnCollection.Add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。