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


C# DataView.DetachRowsAndDispose方法代码示例

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


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

示例1: PotentialMatchesSearchExecute

    public void PotentialMatchesSearchExecute(PotentialClientMatchesState state)
    {
// ReSharper disable InconsistentNaming
      Proc Sponsor_New_Search = null;
// ReSharper restore InconsistentNaming
      switch (state.FieldType)
      {
        case PotentialMatchFieldType.SSN:
          Sponsor_New_Search = new Proc("Sponsor_New_SearchSSN");
          Sponsor_New_Search["@SSN1"] = state.ClientRow["SSN1"];
          Sponsor_New_Search["@SSN2"] = state.ClientRow["SSN2"];
          Sponsor_New_Search["@SSN3"] = state.ClientRow["SSN3"];
          break;
        case PotentialMatchFieldType.Name: Sponsor_New_Search = new Proc("Sponsor_New_SearchName");
          Sponsor_New_Search["@FirstName"] = state.ClientRow["FName"];
          Sponsor_New_Search["@LastName"] = state.ClientRow["LName"];
          break;
      }
      Debug.Assert(Sponsor_New_Search != null, "Sponsor_New_Search != null");

      using (Sponsor_New_Search)
      {
        Sponsor_New_Search["@MatchType"] = string.Format("Matched on {0} {1}",
          state.ClientRow.Field<bool>("IsSponsor") ? "Sponsor" :
            state.ClientRow.Field<bool>("IsSpouse") ? "Spouse" :
              "Dependent",
          state.FieldType);

        Sponsor_New_Search.ExecuteDataSet();

        // if this is the first time through, just take sproc result as our backdrop table
        if (PotentialClientMatches == null)
        {
          Sponsor_New_Search.Table0.Columns.Add("RecordCountId", typeof(int)); //backdrop table's RecordCount has to be a real value since a computed Count() would always be the same for all rows in this table
          foreach (DataRow r in Sponsor_New_Search.Table0.Rows) r["RecordCountId"] = Sponsor_New_Search.Table0.Rows.Count; //fyi, can't use expression based count column because that would reflect the total rows 
          PotentialClientMatches = new DataView(Sponsor_New_Search.Table0) {Sort = "RecordCountId, LName, FName"};
          //sort by ascending RecordCount so that the more specific matches are at the top
        }
        else //otherwise, just keep merging new results into the backdrop table
        {
          // clear out any existing match rows of the same match type, because each NewMatches batch of the same type should be considered an entirely new list of hits specific to the most recent inputs
          using (var v = new DataView(PotentialClientMatches.Table))
          {
            v.RowFilter = String.Format("MatchType = '{0}'", Sponsor_New_Search["@MatchType"]);
            v.DetachRowsAndDispose(true);
          }

          Sponsor_New_Search.Table0.Columns.Add("RecordCountId", typeof(int), "Count(LName)"); //bring the new rows in with their own count
          PotentialClientMatches.Table.Merge(Sponsor_New_Search.Table0);
        }
      }

    }
开发者ID:dggowda047,项目名称:itraacv2-1,代码行数:53,代码来源:SponsorModel.cs

示例2: ClearPreviousMatches

    private void ClearPreviousMatches(string MatchType)
    {
      if (PotentialMatches.Rows.Count == 0) return;

      //clear out any existing match rows of the same match type, because each batch should be considered an entirely new list of hits
      using (DataView v = new DataView(PotentialMatches))
      {
        v.RowFilter = "MatchType = '" + MatchType + "'";
        v.DetachRowsAndDispose();
      }
    }
开发者ID:dggowda047,项目名称:itraacv2-1,代码行数:11,代码来源:tabSponsor+-+before+deactive+rewrite.xaml.cs


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