当我将一行数据插入数据库时,为什么会出现错误,这些数据我正确更新但是我在数据库中动态插入并且更新不起作用....请告诉我为什么我感到困惑?
我收到此信息
无法将参数'ClanOd'的值从'System.String'转换为'System.DateTime'
[InvalidOperationException:无法将参数'ClanOd'的值从'System.String'转换为'System.DateTime'] System.Web.UI.WebControls.ObjectDataSourceView.ConvertType(Object value,Type type,String paramName,ParsingCulture parsingCulture)+416 System.Web.UI.WebControls.ObjectDataSourceView.BuildObjectValue(Object value,Type destinationType,String paramName,ParsingCulture parsingCulture)+166 System.Web.UI.WebControls.ObjectDataSourceView.BuildDataObject(Type dataObjectType,IDictionary inputParameters)+210 System.Web.UI.WebControls.ObjectDataSourceView.ExecuteUpdate(IDictionary键,IDictionary值,IDictionary oldValues)+1276 System.Web.UI.DataSourceView.Update(IDictionary键,IDictionary值,IDictionary oldValues,DataSourceViewOperationCallback回调)+87 System.Web.UI.WebControls.DetailsView.HandleUpdate(String commandArg,Boolean causeValidation)+1091 System.Web.UI.WebControls.DetailsView.HandleEvent(EventArgs e,Boolean causeValidation,String validationGroup)+425 System.Web.UI.WebControls.DetailsView.OnBubbleEvent(Object source,EventArgs e)+89 System.Web.UI.Control.RaiseBubbleEvent(Object source,EventArgs args)+37 System.Web.UI.WebControls.DetailsViewRow.OnBubbleEvent(Object source,EventArgs e)+80 System.Web.UI.Control.RaiseBubbleEvent(Object source,EventArgs args)+37 System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e)+121 System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument)+156 System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)+10 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl,String eventArgument)+13 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)+9528682 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint,Boolean includeStagesAfterAsyncPoint)+1724
答案 0 :(得分:2)
您正尝试将string
值放入datetime
列。
将字符串转换为日期时间,或将列更改为字符串列。
Cannot convert value of parameter 'ClanOd' from 'System.String' to 'System.DateTime'