Trouble with updating Time column through Access ORM.

Thread is closed for posting
2 posts, 0 answers
  1. EIMCM
    EIMCM avatar
    7 posts
    Member since:
    Nov 2010

    Posted 06 Feb 2014 Link to this post

    I have created an MVC project and it is synced to a SQL Management Server 2008 database using Telerik OpenAccess ORM.  In a database table called "Quotes" I have a column called "TimeIn" with data type time(2).  When the db and project are synced, a model is created and the TimeIn property is of DateTime.  I have a view model with a TimeIn property with a DataType of DateTime.  Here is what it looks like:

            [Display(Name = "Time In")]
            [DisplayFormat(ApplyFormatInEditMode=true, DataFormatString = "{hh:mm:ss tt}")]
            public DateTime TimeIn { get; set; }

    I have a strongly typed view for this model and use a Telerik TimePickerFor extension to get the TimeIn property:

            @(Html.Kendo().TimePickerFor(m => m.TimeIn)
                            .Format("hh:mm:ss tt")

    I have a method in the controller that saves the object to the database.  Null values are allowed.  I have no trouble saving the value to the database the first time I create an entry into the database table.   However, when I go to edit this value, I get an error saying "The data types time and datetime are incompatible in the equal operator."  I stumped on this because I'm not sure why I can save an initial entry but not edit it.  I can edit every other column in the db including date columns but not this time column.  Can someone assist me with this issue?

    Thank you for your time,

  2. Boris Georgiev
    Boris Georgiev avatar
    190 posts

    Posted 11 Feb 2014 Link to this post

    Hi Shaun,

    Unfortunately I was not able to reproduce the wrong behavior. I have created a new database with a table witch has column of type time(2), the I have created a new Telerik MVC Web Application with Razor view engine and I have used Telerik Fluent Mapping with DataAnnotations. I used your DataAnnotations and the Kendo.TimePicker code sample, but the error didn't occur. You can find the sample attached. 

    If there is differences between the sample and your code, could you describe us where are they and what are the differences.

    I am looking forward to hearing from you.

    Boris Georgiev
    OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.
Back to Top