简体   繁体   English

无法将参数“日期”的值转换为类型“ System.DateTime”。

[英]Cannot convert the value of parameter 'Date' to the type 'System.DateTime'.'

I use EntityDataSource , i get an error conversion after i format my date 我使用EntityDataSource ,格式化日期后出现错误转换

like that : DataFormatString="{0:dd/MM/yyyy}" 像这样: DataFormatString="{0:dd/MM/yyyy}"

[EntityDataSourceValidationException: Error while setting property 'fromDate': 'Cannot convert the value of parameter 'fromDate' to the type 'System.DateTime'.'.]
   Microsoft.AspNet.EntityDataSource.EntityDataSourceView.ConvertProperties(IDictionary values, PropertyDescriptorCollection propertyDescriptors, ParameterCollection referenceParameters, Dictionary`2 convertedValues) +737
   Microsoft.AspNet.EntityDataSource.EntityDataSourceView.ExecuteDelete(IDictionary keys, IDictionary oldValues) +383
   System.Web.UI.DataSourceView.Delete(IDictionary keys, IDictionary oldValues, DataSourceViewOperationCallback callback) +84
   Telerik.Web.UI.GridTableView.PerformDelete(GridEditableItem editedItem, Boolean suppressRebind) +228
   Telerik.Web.UI.GridCommandEventArgs.ExecuteCommand(Object source) +2417
   Telerik.Web.UI.RadGrid.OnBubbleEvent(Object source, EventArgs e) +91
   System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37

My aspx: 我的aspx:

 <telerik:GridDateTimeColumn HeaderText="تاريخ البداية" UniqueName="fromDate" SortExpression="fromDate" DataField="fromDate" DataFormatString="{0:dd/MM/yyyy}"></telerik:GridDateTimeColumn>

Note : fromDate of type Date in sqlserver db 注意:sqlserver db中Date类型的fromDate

Try that: 试试看:

<telerik:GridBoundColumn DataField="fromDate" DataType="System.DateTime" HeaderText="تاريخ البداية"     
  UniqueName="fromDate" DataFormatString="{0:dd/MM/yyyy}" HtmlEncode="false"/> 

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 不能隐式转换类型System.DateTime? 到System.DateTime - cannot implicitly convert type System.DateTime? to System.DateTime 无法将类型“字符串”转换为“ System.DateTime” - Cannot convert type 'string' to 'System.DateTime' 无法将类型System.DateTime转换为String - Cannot Convert type System.DateTime to String “没有为类型‘System.Nullable`1[System.DateTime]’(参数‘property’)定义属性‘System.DateTime Date’”异常 - “Property 'System.DateTime Date' is not defined for type 'System.Nullable`1[System.DateTime]' (Parameter 'property')” exception 无法隐式转换类型'System.DateTime?'到'System.DateTime'。存在显式转换 - Cannot implicitly convert type 'System.DateTime?' to 'System.DateTime'. An explicit conversion exists 无法隐式转换类型&#39;System.DateTime?&#39; 到LINQ查询中的“ System.DateTime” - Cannot implicitly convert type 'System.DateTime?' to 'System.DateTime' in LINQ query C#无法将类型&#39;string&#39;隐式转换为&#39;System.DateTime&#39; - C# Cannot implicitly convert type 'string' to 'System.DateTime' 错误返回时无法将类型&#39;string&#39;隐式转换为&#39;System.DateTime&#39; - Error Cannot implicitly convert type 'string' to 'System.DateTime' on return 无法将类型&#39;System.DateTime&#39;隐式转换为&#39;string&#39; - Cannot implicitly convert type 'System.DateTime' to 'string' 无法将布尔类型隐式转换为System.DateTime(C#) - Cannot implicitly convert type bool to System.DateTime (C#)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM