我想从一个数据表中选择一些数据并将其复制到另一个数据表中。我在一个问题中找到了答案 - How to query a DataTable in memory to fill another data table
DataTable table = GetDataTableResults();
DataTable results = table.Select("SomeIntColumn > 0").CopyToDataTable();
此代码不起作用并导致错误 -
'System.Array' does not contain a definition for 'CopyToDataTable' and
no extension method 'CopyToDataTable' accepting a first argument of type
'System.Array' could be found (are you missing a using directive or
an assembly reference?)
我使用的是 Visual Studio 2008 和 .net 3.5。
最佳答案
确保您有正确的引用资料。在此,您需要 System.Data.DataSetExtensions 程序集和 System.Data 命名空间。以下链接应该有帮助...
http://msdn.microsoft.com/en-us/library/bb396189(v=vs.110).aspx
祝你好运!
编辑:引用屏幕截图...
关于c# - 将选定的数据从 DataTable 复制到另一个 DataTable,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20308852/