Kevin
Kevin

Reputation: 4747

How to get linqpad to update columns

I am trying to do the equivalent of an SQL UPDATE with C# statements in linqpad but the data doesn't change and I'm not sure to even debug it further to figure out why. The User table is pretty standard with just a string to store Sid.

var usersWithSid = from u in Users where u.Sid != null select u;
foreach(var u in usersWithSid) {
    u.Sid = "S-1-5-21-3812666658-2998621725-2245962016-6618";
}
SubmitChanges();
usersWithSid.Dump();

Most of the examples I have found seem to only update one record at a time. Why doesn't this work?

Upvotes: 8

Views: 5475

Answers (1)

nitzmahone
nitzmahone

Reputation: 13940

Do you have a primary key defined on the table? The updates will silently fail if you don't.

Upvotes: 6

Related Questions