Skip to main content
Sign in
Home
Samples
Languages
Extensions
Documentation
Community
Overview
Visual C++
Visual C#
Visual Basic
JavaScript
Visual F#
Get started for free
Visual Studio Developer Center
>
Languages
>
Visual Basic
>
101 Visual Basic LINQ Samples
>
LINQ To SQL Samples
LINQ to SQL Samples
ADO.NET Interop
Connection Interop
Transaction Interop
Advanced
Dynamic query - Select
Dynamic query - Where
Dynamic query - OrderBy
Dynamic query - Union
Identity
Nested in FROM
Conversion Operators
AsEnumerable
ToArray
ToList
ToDictionary
COUNT/SUM/MIN/
MAX/AVG
Count - Simple
Count - Conditional
Sum - Simple
Sum - Mapped
Min - Simple
Min - Mapped
Min - Elements
Max - Simple
Max - Mapped
Max - Elements
Average - Simple
Average - Mapped
Average - Elements
DataContext Functions
CreateDatabase() and DeleteDatabase()
DatabaseExists()
SubmitChanges()
CreateQuery()
Log
Direct SQL
SQL Query
SQL Command
EXISTS/IN/ANY/ALL
Any - Simple
Any - Conditional
All - Conditional
GROUP BY/HAVING
GroupBy - Simple
GroupBy - Max
GroupBy - Min
GroupBy - Average
GroupBy - Sum
GroupBy - Count
GroupBy - Count - Conditional
GroupBy - followed by Where
GroupBy - Multiple Columns
GroupBy - Expression
Inheritance
Simple
OfType
IS
CType
Cast
UseAsDefault
Insert New Record
INSERT/UPDATE/DELETE
Insert - Simple
Insert - 1-to-Many
Insert - Many-to-Many
Update - Simple
Update - Multiple
Delete - Simple
Delete - One-to-Many
JOIN
SelectMany - 1 to Many - 1
SelectMany - 1 to Many - 2
SelectMany - Many to Many
SelectMany - Self-Join
GroupJoin - Two-way join
GroupJoin - Three-way join
GroupJoin - LEFT OUTER JOIN
GroupJoin - Projected let assignment
GroupJoin - Composite Key
GroupJoin - Nullable\\Nonnullable Key Relationship
NULL
Null
Nullable(Of T).HasValue
Nullable(Of T).Value
Object Identity
Object Caching - 1
Object Caching - 2
Object Loading
Deferred Loading - 1
Including - Eager Loading - 1
Deferred Loading - 2
Including - Eager Loading - 2
Deferred Loading - (1:M)
Deferred Loading - (BLOB)
Optimistic Concurrency
Get conflict information
Resolve conflicts: Overwrite current values
Resolve conflicts: Keep current values
Resolve conflicts: Keep changes
Custom resolve rule
Submit with FailOnFirstConflict
Submit with ContinueOnConflict
ORDER BY
OrderBy - Simple
OrderBy - With Where
OrderByDescending
ThenBy
ThenByDescending
OrderBy - Group By
Paging
Paging - Index
Paging - Ordered Unique Key
SELECT/DISTINCT
Select - Simple
Select - Anonymous Type 1
Select - Anonymous Type 2
Select - Anonymous Type 3
Select - Named Type
Select - Filtered
Select - Shaped
Select - Nested
Distinct
Simultaneous Changes
Optimistic Concurrency - 1
Transactions - Implicit
Transactions - Explicit
Stored Procedures
Scalar Return
Single Resultset
Multiple Resultsets
Out parameters
Function
Query over methods
String/Date Functions
String Concatenation
String.Length
String.Contains(substring)
String.IndexOf(substring)
String.StartsWith(prefix)
String.EndsWith(suffix)
String.Substring(start)
String.Substring(start, length)
String.ToUpper()
String.ToLower()
String.Trim()
String.Insert(pos, str)
String.Remove(start)
String.Remove(start, length)
String.Replace(find, replace)
DateTime.Year
DateTime.Month
DateTime.Day
TOP/BOTTOM
Take
Skip
UNION ALL/UNION/
INTERSECT
Concat - Simple
Concat - Compound
Union
Intersect
Except
User-Defined Functions
Scalar Function - Select
Scalar Function - Where
Table-Valued Function
Table-Valued Function - Join
View
Query - Anonymous Type
Query - Negative
Query - Identity mapping
WHERE
Where - 1
Where - 2
Where - 3
Where - 4
Where - 5
First - Simple
First - Element
First - Condition