Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
LINQ To SQL:Creating a new entity
WhatsApp
Vijai Anand Ramalingam
13y
4.4
k
0
0
25
Blog
EmpDetails Table:
Code:
To create a new entity to the EmpDetails table.
using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Text;
namespace
LINQ
{
class
Program
{
static
void
Main(
string
[] args)
{
DataClassesDataContext
dc =
new
DataClassesDataContext
();
EmpDetail
newEmp =
new
EmpDetail
();
newEmp.Name =
"Ranjith"
;
newEmp.Location =
"Mumbai"
;
newEmp.ID = 8;
newEmp.Dept =
"LN"
;
newEmp.Allowance = 56300;
dc.EmpDetails.InsertOnSubmit(newEmp);
dc.SubmitChanges();
}
}
}
Up Next
Entity Framework vs LINQ to SQL
Ebook Download
View all
Printing in C# Made Easy
Read by 22.3k people
Download Now!
Learn
View all
Membership not found