sanjay maurya
Describe the benefits of LINQ on dataset
By sanjay maurya in ASP.NET on Dec 21 2013
  • Madan Shekar
    Oct, 2018 29

    To run strongly typed queries on data set

    • 0
  • Pankaj Singh
    Jan, 2014 2

    The main aim of using LINQ to Dataset is to run strongly typed queries on Dataset.

    Suppose we want to combine the results from two Datasets, or we want to take a distinct value from the Dataset, then it is advisable to use LINQ. Normally you can use the SQL queries to run on the database to populate the Dataset, but you are not able to use SQL query on a Dataset to retrieve a particular values. To get this you need to use ADO.NET functionalities. But, in case of LINQ, it provides more dignified way of querying the Dataset and provides some new features as compared to ADO.NET.

    Example:
    DataSet ds = new DataSet(); ds.Locale = CultureInfo.InvariantCulture; FillDataSet(ds); DataTable products = ds.Tables["Product"]; IEnumerable query = from product in products.AsEnumerable() orderby product.Field("ListPrice") descending select product; // Force immediate execution of the query. IEnumerable productsArray = query.ToArray(); Console.WriteLine("Every price from highest to lowest:"); foreach (DataRow prod in productsArray) { Console.WriteLine(prod.Field("ListPrice")); }

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS