Advertisement
Milotronik

Linq 11

Jun 7th, 2012
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
ASP 1.03 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.UI;
  6. using System.Web.UI.WebControls;
  7.  
  8. public partial class _11 : System.Web.UI.Page
  9. {
  10.     protected void Page_Load(object sender, EventArgs e)
  11.     {
  12.         DataClassesDataContext db = new DataClassesDataContext();
  13.  
  14.         var qry = from emp in db.Employees
  15.                   join dat in db.Customers on emp.City equals dat.City
  16.                   select new {FirstName = emp.FirstName,
  17.                               LastName = emp.LastName,
  18.                               CompanyName = dat.CompanyName,
  19.                               ContactName = dat.ContactName
  20.                   };
  21.  
  22.         GridView1.DataSource = qry;
  23.         GridView1.DataBind();
  24.  
  25.     }
  26.  
  27.     /*
  28.      *  Mediante el uso de la clausula join seleccione los campos LastName y
  29.         FirstName de la tabla Employees y los campos ContactName y
  30.         Company Name que sean de la misma ciudad (City). Muestre los
  31.         resultados en un GridView.
  32.      */
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement