DateTime.Kind on datetime fields

Posts   
 
    
Posts: 2
Joined: 11-Mar-2010
# Posted on: 11-Mar-2010 22:25:46   

It seems that the datetime.Kind on our DateTime objects are coming back as unspecified. We are saving the datetime as utc. I'm pretty sure the db doesn't have a clue as to the type it was saved with but is there any way to set the Kind of Datetime it should be set to when loading from the database.

Should the datetime be coming back as unspecified? Is there anyway to set the Kind as utc in llblgen properties?

thanks Scott

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 12-Mar-2010 03:25:04   

LLBLGen version and runtime library version?

Is this thread helpful? http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=14833

David Elizondo | LLBLGen Support Team
Posts: 2
Joined: 11-Mar-2010
# Posted on: 12-Mar-2010 16:34:01   

In the thread they are talking about an oracle database. We are using sql server 2005. The same probably applies, it's in the driver. Any settings in the sql server driver that can be changed. How about a converter on the datetime field to set the Kind.

SD.LLBLGen.Pro.ORMSupportClasses.NET20.dll - 2.6.09.0313 SD.LLBLGen.Pro.DQE.SqlServer.NET20.dll - 2.6.08.1114 LLBLGen Pro. Version: 2.6 Final (October 6th, 2008 )

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39615
Joined: 17-Aug-2003
# Posted on: 13-Mar-2010 10:59:18   

Please upgrade to the latest runtime lib build and try again. However, keep in mind that the value instance (e.g. a DateTime instance) is created by the ado.net provider, so if the ado.net provider thinks the datetime kind is unspecified, it will set it like that. I don't recall that sqlserver's meta-data stores this kind in the table meta-data (so we don't retrieve it either)

If it really is a big problem, use a typeconverter which converts from datetime to datetime and returns the datetime value as UTC

Frans Bouma | Lead developer LLBLGen Pro