Part 2 Insert Update Delete using LINQ to SQL

Pubblicato il: 04 settembre 2014
sul canale di: kudvenkat
116,925
399

Text version of the video
http://csharp-video-tutorials.blogspo...

Healthy diet is very important both for the body and mind. If you like Aarvi Kitchen recipes, please support by sharing, subscribing and liking our YouTube channel. Hope you can help.
   / @aarvikitchen5572  

Slides
http://csharp-video-tutorials.blogspo...

LINQ to SQL Tutorial - All Text Articles & Slides
http://csharp-video-tutorials.blogspo...

LINQ to SQL Tutorial Playlist
   • LINQ to SQL Tutorial  

Dot Net, SQL, Angular, JavaScript, jQuery and Bootstrap complete courses
https://www.youtube.com/user/kudvenka...


In this video, we will discuss performing Insert Update and Delete using LINQ to SQL. We will continue with the example, we worked with in Part 1. In Part 1, we discussed performing a Select using LINQ to SQL. Please watch Part 1 before proceeding.

Insert using LINQ to SQL
using (SampleDataContext dbContext = new SampleDataContext())
{
Employee newEmployee = new Employee
{
FirstName = "Tim",
LastName = "T",
Gender = "Male",
DepartmentId = 1,
Salary = 55000
};

dbContext.Employees.InsertOnSubmit(newEmployee);
dbContext.SubmitChanges();
}

Update using LINQ to SQL
using (SampleDataContext dbContext = new SampleDataContext())
{
Employee employee = dbContext.Employees.SingleOrDefault(x =] x.ID == 8);

employee.Salary = 65000;

dbContext.SubmitChanges();
}

Delete using LINQ to SQL
using (SampleDataContext dbContext = new SampleDataContext())
{
Employee employee = dbContext.Employees.SingleOrDefault(x =] x.ID == 8);
dbContext.Employees.DeleteOnSubmit(employee);
dbContext.SubmitChanges();
}


In questa pagina del sito puoi guardare il video online Part 2 Insert Update Delete using LINQ to SQL della durata di ore minuti seconda in buona qualità , che l'utente ha caricato kudvenkat 04 settembre 2014, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 116,925 volte e gli è piaciuto 399 spettatori. Buona visione!