复制数据表的问题
我有一个问题。 trehe 的代码如下所示。
DataRow[] dra = dt_Persons.Select("name = 'Joe'");
dtFiltered = dra.CopyToDataTable();
但是它给出了这样的错误 System.Array' does not contains a 定义 'CopyToDataTable' 并且没有扩展方法 'CopyToDataTable' 接受类型 'System.Array' 的第一个参数发现
因此,如果您知道此错误的解决方案,请帮助我。
谢谢...
i have a problem. trehe is code like below..
DataRow[] dra = dt_Persons.Select("name = 'Joe'");
dtFiltered = dra.CopyToDataTable();
But it gives an error like this 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
So if you know the solution for this error please help me.
Thanks...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于该方法,您需要 System.Data.DataSetExtensions 命名空间中的扩展方法(可在 System.Data.DataSetExtensions.dll 中找到);所以尝试添加:
到文件的顶部。如果这不起作用,请添加对该 dll 的 dll 引用。那么:
应该可以工作,假设 dtFiltered 被输入为 DataTable。
For that method, you need the extension method from the
System.Data.DataSetExtensions
namespace (and found in System.Data.DataSetExtensions.dll); so try adding:to the top of your file. If that doesn't work, add a dll reference to the dll. Then:
should work, assuming
dtFiltered
is typed as aDataTable
.