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 102 | Next

Scott Klein

"Professional LINQ"

Contact")]
public class Contact
{
[Column(DBType = "nvarchar(8) not null")]
public string Title;
[Column(DBType = "nvarchar(50) not null")]
public string FirstName;
47
Part I: Introduction to Project LINQ
[Column(DBType = "nvarchar(50) not null")]
public string MiddleName;
[Column(DBType = "nvarchar(50) not null")]
public string LastName;
[Column(DBType = "nvarchar(50) not null")]
public string EmailAddress;
[Column(DBType = "int")]
public int EmailPromotion;
}
}
Place the following code in the click event for the Close button:
Application.Exit();
Next, in the click event for the Query Method button, place the following code:
DataContext context = new DataContext("Initial Catalog=AdventureWorks;@@ta
Integrated Security=sspi");
Table contact = context.GetTable();
var query =
from c in contact
where c.FirstName.StartsWith("S")
&& c.LastName.StartsWith("K")
orderby c.LastName
select c;
foreach (var item in query)
listBox1.Items.Add(item.FirstName + " " + item.LastName + " " +
item.EmailAddress);
This code creates a query expression filtering all contacts whose first name begins with the letter S and
whose last name begins with the letter K, all sorted by the contacts??™ last name.


Pages:
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6