TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
TAN WhoAMI
NA
291
0
Add Record to table, but System.Data.Entity.Validation error
Jun 6 2013 9:07 PM
I am using the EF 5.0 to Add Record to a table named Customer of the Northwind database, but always got this System.Data.Entity.Validation.DbEntityValidationException.Can anyone help?
Code as below:
private void Add_btn_Click(object sender, RoutedEventArgs e)
{
using (NorthwindEntities context = new NorthwindEntities())
{
Customer cust = new Customer()
{
CompanyName = "DotNetCurry",
ContactName = "Suprotim Agarwal"
};
context.Customers.Add(cust);
try
{
context.SaveChanges();
}
catch (DbEntityValidationException ex)
{
MessageBox.Show(ex.ToString());
}
}
}
Reply
Answers (
1
)
How to pass id(value) to another form in vb.net
Ping from website to windows application?