Ok, I'm using SQL Server Express 2008 and .Net 3.5 (c#)
I have a couple of datetime fields in the database and am trying to make an edit to a row (Using Linq-to-Sql) I receive the error "Row not found or changed."
I have spent some time getting the generated SQL and it seems that the issue is caused by the milliseconds attached to the datetime.
Generated SQL that does not work,
@p5: Input DateTime (Size = 0; Prec = 0; Scale = 0) [20/10/2009 16:04:45]
@p6: Input DateTime (Size = 0; Prec = 0; Scale = 0) [23/10/2009 10:15:36]
@p7: Input DateTime (Size = 0; Prec = 0; Scale = 0) [23/10/2009 09:27:27]
AND ([SignUpDate] = @p5)
AND ([LastActivityDate] = @p6)
AND ([LastLoginDate] = @p7)
if i modify it myself like so it works,
@p5: Input DateTime (Size = 0; Prec = 0; Scale = 0) [20/10/2009 16:04:45.390]
@p6: Input DateTime (Size = 0; Prec = 0; Scale = 0) [23/10/2009 10:15:36.733]
@p7: Input DateTime (Size = 0; Prec = 0; Scale = 0) [23/10/2009 09:27:27.747]
AND ([SignUpDate] = @p5)
AND ([LastActivityDate] = @p6)
AND ([LastLoginDate] = @p7)
What are my options in ways to get arround this?
Just to add this is my edit code,
var UserToEdit = this.GetUser(UserId);
UserToEdit.Forename = Fields["Forename"];
UserToEdit.Surname = Fields["Surname"];
UserToEdit.DateOfBirth = Convert.ToDateTime(Fields["DateOfBirth"]);
UserToEdit.DisplayName = Fields["DisplayName"];
UserToEdit.TelephoneNumber = Fields["TelephoneNumber"];
_db.SubmitChanges();