Saving Dates

Posts   
 
    
Anthony
User
Posts: 155
Joined: 04-Oct-2006
# Posted on: 22-Feb-2008 02:16:35   

Using LLBLGEN 2.5 with dotnet2

Have a webservices that saves an entity to database. I have a field called DateModified that i set on the client and save to the database through the webservice.

When i return the entity to the client and compare DateModified that is returned with what i sent..it is different by 1 millisecond?

Why?

I am comparing the sent DateModified to returned DateModified to ensure entity has been saved.

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 22-Feb-2008 10:16:37   

Must be something in your code simple_smile We can't tell as we don't have the code.

Anyway I'd have set the DateModified on the server, if it's the current date.

arschr
User
Posts: 894
Joined: 14-Dec-2003
# Posted on: 22-Feb-2008 16:36:31   

Could it be a rounding difference due to difference datetime resolutions in dot.net vs the database server's datetime implementation?

jmeckley
User
Posts: 403
Joined: 05-Jul-2006
# Posted on: 22-Feb-2008 17:00:33   

i have heard of this problem before with datetime values for concurrency. it also exists if a given row is updated multiple times within a millisecond. The prefered solution is to use the timestamp column type which is stored as a binary. if it increments by 1 then it was updated. if it doesn't increment, it was not updated. finally, if it is incremented by more than one it was updated mulitple times since the last time saved.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39905
Joined: 17-Aug-2003
# Posted on: 23-Feb-2008 12:39:08   

The date is sent using XML date encoding, though I think it can be that the differences are in millisecond ranges because for example sqlserver uses a lower precision than .NET for time values.

Frans Bouma | Lead developer LLBLGen Pro