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

Scott Klein

"Professional LINQ"


AdventureWorks db = new AdventureWorks("Integrated Security=sspi");
//Add a new contact
Contact con = new Contact();
con.Firstname = "Sammy";
con.MiddleName = "T";
con.LastName = "Hagar";
con.NameStyle = 0;
con.EmailPromotion = 1;
con.EmailAddress = "RedRocker@Adventure-works.com";
con.Title = "Mr.";
db.Contacts.Add(con);
db.SubmitChanges();
//Update an existing contact
Contact cont = db.Contacts.Single(c => c.ContactID == 1280);
cont.EmailAddress = "christiank@adventure-works.com";
cont.NameStyle = 0;
db.SubmitChanges();
Keep in mind that only those properties that have changed are ushered back to the database. For instance,
if the NameStyle for Christian was already 0, then that change won??™t be made in the database.
Submitting Entity Changes
Along with tracking changes, entity classes can be used to submit changes that have been made to the
entity, such as adding, updating, or deleting records. Manipulating data is one of the key aspects of
LINQ to SQL, and entity classes make those operations extremely easy. Changes can be made simply by
manipulating the objects in your object model.


Pages:
393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6