tags:

views:

124

answers:

1

Is there a way in SubSonic to update some columns of a table?

For instance

Dal.Users users = new Dal.Users();

users.UserId = user.id;
users.Email = user.email;
users.FirstName = user.firstName;
users.LanguageId = user.languageId;
users.LastName = user.lastName;
users.Password = user.password;
users.UserName = user.userName;
users.Data = user.data;

users.IsNew = (user.id == -1);

users.Save()

Is it possible for instance to comment out the line users.Password = user.password; so that this field will not be updated (but will also not be set to null in the database).

+1  A: 

What version are you using? The latest (2.1) only updates changed columns in the database. Actually, every version I've ever used has never set a field to null if it wasn't specified so something else must be going on.

John Sheehan
So if I leave out users.Password = user.password; the Password column will be left unchanged?
Lieven Cardoen
Yes, that is correct
John Sheehan