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
Kliment Janceski
NA
5
0
Entity framework UPDATE
Sep 5 2011 5:00 PM
Hi,
I have simple update method and have problem with it.
public ReturnCodes UpdateProduct(Product product)
{
try
{
dbObjects db = new dbObjects();
Product pro = db.Products.FirstOrDefault(t => t.UniqueID == product.UniqueID);
pro = product;
int i = db.SaveChanges();
return ReturnCodes.SUCCESS;
}
catch (Exception exc)
{
return ReturnCodes.SYSTEM_ERROR;
}
}
But variable i is 0 so it means that no record is affected. When i change the line
pro = product;
with
pro.name = product.name;
pro.price = product.price;
.....
it works just fine. New to entity framework so pls give me some explanation.
Reply
Answers (
1
)
DateTime
System.IO.FileNotFoundException: Could not load file or assembly '***.dll