【问题标题】:.NET Get the rows from the Table of the dataset.NET 从数据集的表中获取行
【发布时间】:2018-10-30 23:46:40
【问题描述】:

我错过了一些东西
我有一个带有表格数据集的应用程序
我需要检查某些行的​​特定数据,但我做错了。
那么我如何从现有数据集中的现有表中填充临时数据表。 我设置:

   Dim myDataset as new myApplication.myDataset
   Dim myTable as new dataTable
   mytable = myDataset.Tables(nameOfTable)
   ' Here i get everything but the rows
   ' So how i load the rows in the above datatable
   ' Right now i get a nice round 0

【问题讨论】:

    标签: .net datatable dataset


    【解决方案1】:

    我不确定我的问题是否正确,但如果您想使用表名获取表,请尝试:

    DataSet.Tables[tableName];

    你也可以获取行数:

    DataSet.Tables[tableName].Rows;

    填充数据表

    DataTable dataName = DataSet[tableName].AsEnumerable().CopyToDataTable();

    【讨论】:

    • 这就是我所做的,我得到了 0 对于 mytable .Rows 中的每一行但 myTable.Rows 得到 0
    • 尝试使用 myDataset[tableName].Rows 并验证它不是 0,这是你有一个空数据集。
    • 如果 myDataset 不为空则:myTable = myDataset.Tables[tableName].AsEnumerable().CopyToDataTable()
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-05-09
    • 1970-01-01
    • 1970-01-01
    • 2012-10-11
    • 1970-01-01
    • 1970-01-01
    • 2015-03-19
    相关资源
    最近更新 更多