从一个Datatable到另一个datatble中选择数据 [英] Selecting data from one Datatable to another datatble

查看:139
本文介绍了从一个Datatable到另一个datatble中选择数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下代码

I have following code

For Each datarow In dtuserdeatils.Rows
    UserPointdeatils = dtPointdeatils.Clone()
    k = datarow("ID")

    For Each drpd In dtPointdeatils.Select("ID=" + k)
         UserPointdeatils.ImportRow(drpd)
    Next
   
    If Not UserPointdeatils Is Nothing Then
        //My Code
    End If
Next 



这里问题是我的数据表 UserPointdeatils 只有一列,即 ID 其中 dtPointdeatils 有5列。

如何在 UserPointdeatils dtPointdeatils 的所有列c>?


Here the issue is my datatable UserPointdeatils have only one column i.e ID where as dtPointdeatils has 5 columns.
How can I get all the column of dtPointdeatils in UserPointdeatils?

推荐答案

您可以使用 datatable 复制方法c $ c>将一个表复制到另一个表。有关详细信息,请参阅以下链接:



http://msdn.microsoft.com/en-us/library/system.data.datatable.copy.aspx [ ^ ]
You can use the Copy method of datatable to copy one table to another. refer the following link for details:

http://msdn.microsoft.com/en-us/library/system.data.datatable.copy.aspx[^]


这篇关于从一个Datatable到另一个datatble中选择数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆