Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

How do I query a DataTable object by using LINQ?

datatable LINQ object query
0
Posted

How do I query a DataTable object by using LINQ?

0

[top] LINQ can query any data source that implements the IEnumerable interface. To query a DataTable object, first call the AsEnumerable method of the DataTable class. You can then use LINQ to query the data. The following example shows how: var nostr = from u in dt.AsEnumerable() where u.Field(“m”).ToString().ToUpper().StartsWith(“3”) select new { MONEY = u.Field(“m”), TIME = u.Field(“t”), EXT = “Extra Column” }; Sincerely, Allen Chen Microsoft Online Community Support Please remember to mark the replies as answers if they help and unmark them if they provide no help.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.