本文整理汇总了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;
}
示例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;
}
示例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
{
}
}
示例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);
}
示例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));
}
示例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);
}
示例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());
}