Monday, 4 July 2016

How to get a list from a dataview using Linq

How to get a list from a dataview using Linq


In .Net is common to get data from a database into a dataview.
To use these data it can be useful to convert them into a list.

This is how to do that in VB.Net.

dim dataFromDB as DataView = GetDV("select ...")

dim dataList as List(Of String) = _
dataFromDB.Cast(Of DataRowView).Select(Function(dr) dr("fieldName").ToString).ToList


No comments:

Post a Comment