_lastName;
}
set
{
if ((this._lastName != value))
{
this._lastName = value;
}
}
}
[Column(Name = "UnitPrice", Storage = "_unitPrice", DBType = "decimal")]
public decimal UnitPrice
232
Chapter 11: LINQ to SQL Queries
{
get
{
return this._unitPrice;
}
set
{
if ((this._unitPrice != value))
{
this._unitPrice = value;
}
}
}
}
You are almost done. The last step is to add the code behind the button. Add the following code to the
click event of button1:
private void button1_Click(object sender, EventArgs e)
{
AdventureWorks db = new AdventureWorks("Integrated Security=sspi");
IEnumerable
result = db.SalesOrders(275);
foreach (OrdersBySalesPersonID ord in result)
{
listBox1.Items.Add(ord.ProductID + " " + ord.ProductName + " " +
ord.SalesPerson + " " + ord.UnitPrice);
}
}
That??™s it! In Visual Studio, select Debug ??? Start Debugging, or press the F5 key. Oops! You received some
compilation errors, didn??™t you? They probably state something like the following:
The type or namespace ??™MethodInfo??™ could note be found.
Pages:
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379