DataTable

How to use linq query on a datatable in C#

Is it possible to perform a linq query on datatable, answer is no because datatable’s row collection, DataRowCollection does not implement IEnumerable<T> so we cannot perform linq query on it. But if there is any way to convert our datatable data row collection into IEnumerable, then surely we can. In this article we will see how to convert a datatable inot IEnumerable and perform Linq query and... By Charles Fuller   On 25 Jun 2013  Viewed: 1,939
  • datatable
  • linq
  • c#

Convert datatable to json in C#

To convert a DataTable into JSON in C# is really very easy. Is there any class or method in .Net which can help us to directly do it, then answer is No. We need to write a small utility class or method which can help to convert any datatable into json easily.What we are going to do is, create a dictionary to keep column name and column values and then create the list of all the columns and values... By Ali Adravi   On 09 Jun 2013  Viewed: 19,835
  • json
  • datatable

How to fill datatable from datareader in C# without dataadapter?

Most of the developer use DataAdapter to fill the DataSet and then take the first table from the data set, which is quite slow, why can't we use DataReader to read the data and use datatable's Load method to load the reader into it, in this article we will see how we can load a table faster and easier way, even without using the DataSet and DataAdapter. First of all set our connection string... By Alicia Gonzalez   On 09 Jun 2013  Viewed: 8,687
  • datatable
  • data-reader
  • c#