public class MsSql2008Dialect : MsSql2005Dialect
{
protected override void RegisterDateTimeTypeMappings()
{
base.RegisterDateTimeTypeMappings();
RegisterColumnType(DbType.DateTime2, "DATETIME2");
RegisterColumnType(DbType.DateTimeOffset, "DATETIMEOFFSET");
RegisterColumnType(DbType.Date, "DATE");
RegisterColumnType(DbType.Time, "TIME");
}


On Mon, Apr 18, 2011 at 7:11 PM, Neal Groothuis <[email protected]>wrote:

> Hey all,
>
> I have a table with two TIME columns on a SQL Server 2008 database.
> I'm running into problems when I try to query against them, and I
> think this is a bug in the Set() methods for the TimeAsTimeSpanType,
> TimeSpanType, and TimeType classes.
>
> All of these methods add the value that's passed to the Set() method
> to the parameter array as a DateTime object, but at least on this MSDN
> page (http://msdn.microsoft.com/en-us/library/cc716729.aspx), it shows
> that the .NET type that's associated with DbType.Time should be
> TimeSpan, not DateTime.  This is preventing me from running queries
> against these columns, because I always get an operand type clash:
> "The data types time and datetime are incompatible in the less than
> operator." (I'm doing a comparison between the parameter that I'm
> passing in and one of the TIME columns.)
>
> I'll likely try to work around this tomorrow by creating my own time
> type class with the correct type being placed into the command array.
> Can anyone else offer any insights into this?  If not, I'll also raise
> it as an issue in the project's JIRA instance.
>
> - Neal
>
> --
> You received this message because you are subscribed to the Google Groups
> "nhusers" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/nhusers?hl=en.
>
>


-- 
Fabio Maulo

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to