blog




  • Essay / Microsoft Language Integrated Query (LINQ) for SQL Ie...

    Microsoft Language Integrated Query (LINQ) for SQL ie LINQ to SQLIntroduction:This article is about LINQ (Language Integrated Query) which is one of the most fun and functionality in .NET programming. LINQ makes data querying a unique programming concept in .NET. Querying data can be done from XML (LINQ to XML), a database (ADO.NET enabled LINQ, LINQ to SQL, LINQ to Dataset, LINQ to Entities) and an object (LINQ to Objects). LINQ can easily and highly extensible and allow developers to create custom data providers to access data. For example. LINQ to Amazon, LINQ to Excel, LINQ to Javascript, etc. The scope of this article is limited to LINQ to SQL. This is the use of LINQ to access database data, specifically Microsoft SQL Server. Why LINQ Many developers must use two or more programming languages: a high-level language for business logic and presentation layers (like Visual C# or Visual Basic) and a query language for interacting with the database (like Transact-SQL, P-SQL). This requires the developer to be proficient in multiple languages ​​to be effective. For example, an application that uses a data access API to run a query against a database specifies the query as a literal string using quotation marks, such as "select * from product." This query string is unreadable to the compiler and is not checked for errors, such as invalid syntax or whether the columns or rows it references actually exist in the database table. There is no type checking of query parameters and no IntelliSense support is available either. Language-Integrated Query (LINQ) allows developers to form set-based queries in their application code, without having to use a separate query language. You can write LINQ queries in the middle of paper......brutines and can be on one or more lines. You can pass values ​​from the current scope to a lambda expression. (Microsoft definition) The following example is a lambda expression that increments its argument and returns the value. The example shows both single-line and multi-line lambda expression syntax for a function. Example from Microsoft (http://msdn.microsoft.com/en-us/library/bb531253.aspx) Conclusion: This is a brief introduction to Microsoft LINQ specifically LINQ to SQL. To learn more, please visit the links below to explore the power of LINQ; • http://msdn.microsoft.com/en-us/library/bb385100.aspx • http://msdn.microsoft.com/en-us/ vstudio/bb688085.aspx • http://en.wikipedia.org /wiki/Language_Integrated_Query• http://www.codeproject.com/Articles/24448/LINQ-to-SQL-Samples• http://codesamplez.com/ database/tutorial linq-to-sql-c-sharp