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


C# DataRow.GetRecordFromVersion方法代码示例

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


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

示例1: SilentlySetValue

        internal void SilentlySetValue(DataRow dr, DataColumn dc, DataRowVersion version, object newValue) {
            // get record for version
            int record = dr.GetRecordFromVersion(version);

            bool equalValues = false;
            if (DataStorage.IsTypeCustomType(dc.DataType) && newValue != dc[record]) {
                // if UDT storage, need to check if reference changed. See bug 385182
                equalValues = false;
            }
            else {
                equalValues = dc.CompareValueTo(record, newValue, true);
            }

            // if expression has changed
            if (!equalValues) {
                int[] oldIndex = dr.Table.RemoveRecordFromIndexes(dr, version);// conditional, if it exists it will try to remove with no event fired
                dc.SetValue(record, newValue);
                int[] newIndex = dr.Table.InsertRecordToIndexes(dr, version);// conditional, it will insert if it qualifies, no event will be fired
                if (dr.HasVersion(version)) {
                    if (version != DataRowVersion.Original) {
                        dr.Table.RecordChanged(oldIndex, newIndex);
                    }
                    if (dc.dependentColumns != null) {
                        //BugBug - passing in null for cachedRows.  This means expression columns as keys does not work when key changes.
                        dc.Table.EvaluateDependentExpressions(dc.dependentColumns, dr, version, null);
                    }
                }
             }
             dr.ResetLastChangedColumn();
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:30,代码来源:DataTable.cs

示例2: Eval

        internal override object Eval(DataRow row, DataRowVersion version) {
            if (!found) {
                throw ExprException.UnboundName(name);
            }

            if (row == null) {
                if(IsTableConstant()) // this column is TableConstant Aggregate Function
                    return column.DataExpression.Evaluate();
                else {
                    throw ExprException.UnboundName(name);
                }
            }

            return column[row.GetRecordFromVersion(version)];
        }
开发者ID:uQr,项目名称:referencesource,代码行数:15,代码来源:NameNode.cs

示例3: RemoveRecordFromIndexes

// RemoveRecordFromIndexes removes the given record (using row and version) from all indexes and it  stores and returns the position of deleted
// record from each index
// IT SHOULD NOT CAUSE ANY EVENT TO BE FIRED
        internal int[] RemoveRecordFromIndexes(DataRow row, DataRowVersion  version) {
            int    indexCount          =  LiveIndexes.Count;
            int [] positionIndexes =  new int[indexCount];

            int recordNo = row.GetRecordFromVersion(version);
            DataViewRowState states = row.GetRecordState(recordNo);

            while (--indexCount >= 0) {
                if (row.HasVersion(version) && ((states & indexes[indexCount].RecordStates) != DataViewRowState.None)) {
                    int index = indexes[indexCount].GetIndex(recordNo);
                    if (index > -1) {
                        positionIndexes [indexCount] = index;
                        indexes[indexCount].DeleteRecordFromIndex(index); // this will delete the record from index and MUSt not fire event
                    }
                    else {
                        positionIndexes [indexCount] = -1; // this means record was not in index
                    }
                }
                else {
                    positionIndexes [indexCount] = -1; // this means record was not in index
                }
            }
            return positionIndexes;
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:27,代码来源:DataTable.cs

示例4: InsertRecordToIndexes

// InsertRecordToIndexes inserts the given record (using row and version) to all indexes and it  stores and returns the position of inserted
// record to each index
// IT SHOULD NOT CAUSE ANY EVENT TO BE FIRED
        internal int[] InsertRecordToIndexes(DataRow row, DataRowVersion  version) {
            int    indexCount          =  LiveIndexes.Count;
            int [] positionIndexes =  new int[indexCount];

            int recordNo = row.GetRecordFromVersion(version);
            DataViewRowState states = row.GetRecordState(recordNo);

            while (--indexCount >= 0) {
                if (row.HasVersion(version)) {
                    if ((states & indexes[indexCount].RecordStates) != DataViewRowState.None) {
                        positionIndexes [indexCount] = indexes[indexCount].InsertRecordToIndex(recordNo);
                    }
                    else {
                        positionIndexes [indexCount] = -1;
                    }
                }
            }
            return positionIndexes;
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:22,代码来源:DataTable.cs

示例5: Eval

 internal override object Eval(DataRow row, DataRowVersion version)
 {
     if (!this.found)
     {
         throw ExprException.UnboundName(this.name);
     }
     if (row != null)
     {
         return this.column[row.GetRecordFromVersion(version)];
     }
     if (!this.IsTableConstant())
     {
         throw ExprException.UnboundName(this.name);
     }
     return this.column.DataExpression.Evaluate();
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:16,代码来源:NameNode.cs

示例6: GetColumnValueAsString

        // Return the field value as a string. If the field value is NULL, then NULL is return.
        // If the column type is string and it's value is empty, then the empty string is returned.
        // If the column type is not string, or the column type is string and the value is not empty string, then a non-empty string is returned
        // This method does not throw any formatting exceptions, since we can always format the field value to a string.
        internal string GetColumnValueAsString(DataRow row, DataRowVersion version)
        {
            object objValue = this[row.GetRecordFromVersion(version)];

            if (DataStorage.IsObjectNull(objValue))
            {
                return null;
            }

            string value = ConvertObjectToXml(objValue);
            Debug.Assert(value != null);
            return value;
        }
开发者ID:chcosta,项目名称:corefx,代码行数:17,代码来源:DataColumn.cs

示例7: SilentlySetValue

 internal void SilentlySetValue(DataRow dr, DataColumn dc, DataRowVersion version, object newValue)
 {
     int recordFromVersion = dr.GetRecordFromVersion(version);
     bool flag = false;
     if (DataStorage.IsTypeCustomType(dc.DataType) && (newValue != dc[recordFromVersion]))
     {
         flag = false;
     }
     else
     {
         flag = dc.CompareValueTo(recordFromVersion, newValue, true);
     }
     if (!flag)
     {
         int[] oldIndex = dr.Table.RemoveRecordFromIndexes(dr, version);
         dc.SetValue(recordFromVersion, newValue);
         int[] newIndex = dr.Table.InsertRecordToIndexes(dr, version);
         if (dr.HasVersion(version))
         {
             if (version != DataRowVersion.Original)
             {
                 dr.Table.RecordChanged(oldIndex, newIndex);
             }
             if (dc.dependentColumns != null)
             {
                 dc.Table.EvaluateDependentExpressions(dc.dependentColumns, dr, version, null);
             }
         }
     }
     dr.ResetLastChangedColumn();
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:31,代码来源:DataTable.cs

示例8: RemoveRecordFromIndexes

 internal int[] RemoveRecordFromIndexes(DataRow row, DataRowVersion version)
 {
     int count = this.LiveIndexes.Count;
     int[] numArray = new int[count];
     int recordFromVersion = row.GetRecordFromVersion(version);
     DataViewRowState recordState = row.GetRecordState(recordFromVersion);
     while (--count >= 0)
     {
         if (row.HasVersion(version) && ((recordState & this.indexes[count].RecordStates) != DataViewRowState.None))
         {
             int index = this.indexes[count].GetIndex(recordFromVersion);
             if (index > -1)
             {
                 numArray[count] = index;
                 this.indexes[count].DeleteRecordFromIndex(index);
             }
             else
             {
                 numArray[count] = -1;
             }
         }
         else
         {
             numArray[count] = -1;
         }
     }
     return numArray;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:28,代码来源:DataTable.cs

示例9: InsertRecordToIndexes

 internal int[] InsertRecordToIndexes(DataRow row, DataRowVersion version)
 {
     int count = this.LiveIndexes.Count;
     int[] numArray = new int[count];
     int recordFromVersion = row.GetRecordFromVersion(version);
     DataViewRowState recordState = row.GetRecordState(recordFromVersion);
     while (--count >= 0)
     {
         if (row.HasVersion(version))
         {
             if ((recordState & this.indexes[count].RecordStates) != DataViewRowState.None)
             {
                 numArray[count] = this.indexes[count].InsertRecordToIndex(recordFromVersion);
             }
             else
             {
                 numArray[count] = -1;
             }
         }
     }
     return numArray;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:22,代码来源:DataTable.cs


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