CSharp - Database Query Using LINQ to SQL

Description

Database Query Using LINQ to SQL

using System;  
using System.Linq;  
using System.Data.Linq;  
  
using nwind;  
class Program
{
    static void Main(string[] args)
    {
            Northwind db = new Northwind(@"Data Source=.\SQLEXPRESS;Initial Catalog=Northwind");  
              
            var custs =  
              from c in db.Customers  
              where c.City == "Rio de Janeiro"  
              select c;  
            
                   foreach (var cust in custs)  
                    Console.WriteLine("{0}", cust.CompanyName);  
              
    }
}

Related Topic