从Datatable选择并复制DataTable时出错 [英] Error in selecting from a Datatable and copying the DataTable

查看:345
本文介绍了从Datatable选择并复制DataTable时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试对数据表进行排序。为了做到这一点,你对它进行排序,然后将排序的一个复制到一个datatable中,如下所示 - 如何查询内存中的DataTable以填充另一个数据表

I tried to sort a datatable. To do that, you sort it and then copy the sorted one into a datatable, as shown here - How to query a DataTable in memory to fill another data table

代码 -

DataTable table = GetDataTableResults();
DataTable results = table.Select("SomeIntColumn > 0").CopyToDataTable();

在visual studio中,我看到错误 -

In visual studio, i see the error -

'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?)

如何解决这个问题?

推荐答案

添加对 System.Data.DataSetExtensions.dll 的引用您的项目。

Add reference to System.Data.DataSetExtensions.dll in your project.

如何to:通过使用添加引用对话框添加或删除引用

这篇关于从Datatable选择并复制DataTable时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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