By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,894 Members | 1,110 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,894 IT Pros & Developers. It's quick & easy.

Linq: no update in row

P: n/a
Hi,

Here is my code:

MyDataContext db = new MyDataContext();
Profile profile = db.Profiles.Single(u =u.UserId == userId);

// Edit
profile.Surname = surname;
profile.DateOfBirth = dateOfBirth;
profile.LastUpdate = DateTime.Now;

// Update
db.SubmitChanges();

Here is my situation:
- The data connection works (the user profile gets selected with database
values)
- All input values are new (surname, dateOfBirth, and DateTime.Now)
- I receive no errors, but the row gets not updated for some reasons.

Any ideas why not?

Thanks!

Jul 5 '08 #1
Share this Question
Share on Google+
1 Reply


P: n/a

"Arjen" <bo*****@hotmail.comschreef in bericht
news:0F**********************************@microsof t.com...
Hi,

Here is my code:

MyDataContext db = new MyDataContext();
Profile profile = db.Profiles.Single(u =u.UserId == userId);

// Edit
profile.Surname = surname;
profile.DateOfBirth = dateOfBirth;
profile.LastUpdate = DateTime.Now;

// Update
db.SubmitChanges();

Here is my situation:
- The data connection works (the user profile gets selected with database
values)
- All input values are new (surname, dateOfBirth, and DateTime.Now)
- I receive no errors, but the row gets not updated for some reasons.

Any ideas why not?

Thanks!

Aha, I forgot to set the primary key. Stupid!

Jul 5 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.