SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 511 | Next

Scott Klein

"Professional LINQ"

Name the combo box salesPerson and
name the grid grdOrderDetail. Next, double-click on the form itself to view the code behind. Add the
following two statements to the top of the form:
using System.Data.Objects;
using AdventureWorksModel;
337
Appendix B: LINQ to Entities: The ADO.NET Entity Framework
Add the following line of code to the top of the partial class for the form:
private AdventureWorksEntities productSalesContext;
Add the following code to the Load event of the form:
productSalesContext = new AdventureWorksEntities();
grdProducts.Columns.Add("OrderID", "Order");
grdProducts.Columns.Add("OrderQty", "Quantity");
grdProducts.Columns.Add("ProductID", "Product");
grdProducts.Columns.Add("UnitPrice", "Price");
grdProducts.Columns.Add("LineTotal", "Total");
ObjectQuery salesPerson = productSalesContext.Contact.Where("it
.MiddleName IS NOT NULL").OrderBy("it.LastName");
this.cbosalesPerson.DataSource = salesPerson.Include
("SalesOrderHeader.SalesOrderDetail");
this.cbosalesPerson.DisplayMember = "LastName";
Finally, add the following code to the SelectedIndexChanged event of the combo:
grdProducts.


Pages:
499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6