Introducing Radical.sh

Forget Code launches a powerful code generator for building API's

LINQ - Loading Database file in C#

Using LINQ, database file can be loaded and queried.

Example:
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Xml.Linq;
  5. using System.Text.RegularExpressions;
  6.  
  7. namespace ForgetCode
  8. {
  9. class IntroToLINQ
  10. {
  11. static void Main()
  12. {
  13. database db = new database(@"c:\northwnd.mdf");
  14.  
  15. // Query for customers in London.
  16. IQueryable<Customer> custQuery =
  17. from cust in db.Customers
  18. where cust.City == "London"
  19. select cust;
  20. }
  21. }
  22. }


Here, the customers table is taken in the database 'database'.