This question is locked. New answers and comments are not allowed.
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
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