zoukankan      html  css  js  c++  java
  • DbDataAdapter填充(Fill)DataSet的情况

    Fill 方法支持以下情况:DataSet 包含多个 DataTable 对象,而这些对象的名称只有大小写不同。在这种情况下,Fill 执行区分大小写的比较以查找相应的表,如果不存在完全匹配的表,则新建一个。下面的 C# 代码阐释该行为。

    DataSet dataset = new DataSet();
    dataset.Tables.Add("aaa");
    dataset.Tables.Add("AAA");
    adapter.Fill(dataset, "aaa"); // Fills "aaa", which already exists in the DataSet.
    adapter.Fill(dataset, "Aaa"); // Adds a new table called "Aaa".

    如果调用 Fill 并且 DataSet 只包含一个其名称只有大小写不同的 DataTable,则更新该 DataTable。在这种情况下,比较不区分大小写。下面的 C# 代码阐释该行为。

    DataSet dataset = new DataSet();
    dataset.Tables.Add("aaa");
    adapter.Fill(dataset, "AAA"); // Fills table "aaa" because only one similarly named table is in the DataSet
  • 相关阅读:
    BZOJ 1500 维修数列
    BZOJ 1501 智慧珠游戏
    BZOJ 1507 Editor
    BZOJ 3223 文艺平衡树
    BZOJ 3224 普通平衡树
    BZOJ 3196 二逼平衡树
    BZOJ 1048 分割矩阵
    BZOJ 1047 理想的正方形
    BZOJ 1046 上升序列
    BZOJ 1045 糖果传递
  • 原文地址:https://www.cnblogs.com/lingxzg/p/440211.html
Copyright © 2011-2022 走看看