Saturday 13 October 2012

c sharp programming

HOW TO QUERY LINQ TO SQL DATABASE


using System;
using System.Linq;
using System.Data.Linq;

using nwind;

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);

No comments:

Post a Comment