This is a migrated thread and some comments may be shown as answers.

Trouble with updating Time column through Access ORM.

1 Answer 38 Views
Databases and Data Types
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
EIMCM
Top achievements
Rank 1
EIMCM asked on 06 Feb 2014, 07:04 PM
Hello,
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")]
        [Required]
        [DataType(DataType.Time)]
        [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)
                        .Name("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,
Shaun

1 Answer, 1 is accepted

Sort by
0
Boris Georgiev
Telerik team
answered on 11 Feb 2014, 02:50 PM
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.

Regards,
Boris Georgiev
Telerik
OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.
Tags
Databases and Data Types
Asked by
EIMCM
Top achievements
Rank 1
Answers by
Boris Georgiev
Telerik team
Share this question
or