开发者

Insert into DataTable from DataTable

I want to insert data from one DataTable to another with some conditions. I have found this link useful: http://social.msdn.microsoft.com/Forums/en-US/csharplanguage/thread/7a5d0f88-3e71-435a-ae3c-ff01d1ca22a2/ but I'm not able to put .ToList() for my query. I'm getting the below error:

'System.Data.EnumerableRowCollection<System.Data.DataRow>' does not contain a definition for 'ToList' and no extension method 'ToList' accepting a first argument of type 'System.Data.EnumerableRowCollection<System.Data.DataRow>' could be found (are you missing a using directive or an assembly reference?)

Could some please help me to resolve this?

PS: My query:

(from crow in dtCo开发者_StackOverflow社区nfiguration.AsEnumerable()
                         where crow.Field<string>("FieldType") == "FL"
                         & crow.Field<string>("FieldName") != "DATEADDED"
                         & crow.Field<string>("FieldName") != "DATEMODIFIED"
                         select crow).ToList()


Add the following statement to your code:

using System.Linq;


I think you would need a reference to System.Data.DataSetExtensions commenly found at C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.0\System.Data.DataSetExtensions.dll

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜