.Net Framework, Asp.net, Ado.net, .Net Remoting, .Net Webservice, SQL, XML, XSLT, WCF, WPF, WWF NHibernate, Ajax, Jquery, DHTML

Ado.netAsp.Net 2.0SQLC-SharpXMLFrameworkIISXMLWebServiceArchitecture
UMLProject ManagementSDLCMethodologiesDesign PatterenOOPWCF.Net RemotingWWF
MVPMVCSilver LightN-HibernateAjaxJ-QuerySEO-MarketingSite MapPhp

LINQ (Language Integrated Query) to Ado.net, Linq to Dataset

LINQ is a new component in .net 3.5 Framework

We need to add 3 .dlls for LINQ implementation.

System.Core.dll - Includes the implementation for LINQ to Objects
System.Data.Linq.dll - Includes the implementation for LINQ to SQL
System.Xml.Linq.dll - Includes the implementation for LINQ to XML

Basically LINQ address the current database development model in the context of Object Oriented Programming Model.
It can be devided into three areas
1. LINQ to Object
Queries performed against the in-memory data
2. LINQ to ADO.Net
  • 2.1 LINQ to SQL (formerly DLinq) {Queries performed against the relation database only Microsoft SQL Server Supported}
  • 2.2 LINQ to DataSet {Supports queries by using ADO.NET data sets and data tables}
  • 2.3 LINQ to Entities {Microsoft ORM solution}

  • 3. LINQ to XML (formerly XLinq)
    { Queries performed against the XML source}


    Example shows how to query in a string array.. simple and fun.
    Model code sample
    //Look in the example "select " returns a IEnumerable<string>
    1:
    2:
    3:using System;
    4:using System.Collections.Generic;
    5:using System.Linq;
    6:
    7:namespace Arindam
    8:{
    9: class Program
    10: {
    11: static void Main(string[] args)
    12: {
    13: string[] names = { "Burke", "Connor", "Frank", "Everett", "Albert", "George", "Harris", "David" };
    14:
    15: IEnumerable<string> query = from s in names where s.Length == 5 orderby s select s.ToUpper();
    16:
    17: foreach (string item in query)
    18: {
    19: Console.WriteLine(item);
    20: }
    21: Console.ReadLine();
    22: }
    23:
    24: }
    25:}
    26:

    Now take a look how we can bind datasource from LINQ query.
    Bind gridview from linq query
    void LoadGrid()
    1: {
    2: string[] cities = { "London", "Amsterdam", "San Francisco", "Las Vegas","Boston", "Raleigh", "Chicago", "Charlestown", "Helsinki", "Nice", "Dublin" };
    3:
    4: gvLinq.DataSource = from city in cities where city.Length > 4 orderby city select city.ToUpper();
    5: gvLinq.DataBind();
    6:
    7:
    8: }
    9:
    Leave your comment.
    Name
    Email
    Comments
    Tell Us9629+5 =

    Reduce your Dialy IT Cost, Consult with us
    Stay healthy in recession

    Advertisement
    Sponsored by

    Privacy Policy ©2009 ETG Consultancy, All Rights Reserved Terms & Conditions
    Asp.net, Ado.net, .Net Remoting, .Net Webservice, SQL, XML, XSLT, WCF, WPF, WWF NHibernate, Ajax, Jquery, DHTML