_lastName;
}
set
{
if ((this._lastName != value))
{
this._lastName = value;
}
}
}
[Column(Name = "Title", Storage = "_Title", DBType = "nvarchar(50)")]
public string Title
{
get
{
return this._Title;
}
242
Chapter 11: LINQ to SQL Queries
set
{
if ((this._Title != value))
{
this._Title = value;
}
}
}
}
Last, add the code behind button5:
private void button5_Click(object sender, EventArgs e)
{
AdventureWorks db = new AdventureWorks("Integrated Security=sspi");
var result = from emp in db.EmpInfo(21)
select emp;
foreach (EmployeeInfo ei in result)
listBox1.Items.Add(ei.ContactID + " " + ei.FirstName
+ " " + ei.LastName + " " + ei.Title);
}
This code is not really that different from calling a stored procedure.
Press F5 to compile and run the project. One last ??????Oops!??™??™ This time the error says something
like this:
The type of namespace name ??™MethodCallExpression??™ could not be found.
Once again, that??™s because you are missing a using directive. Add the highlighted using directive to
your code:
using System.
Pages:
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393