【问题标题】:Inserting is not supported by data source 'SqlDataSource1' unless InsertCommand is specified除非指定了 InsertCommand,否则数据源“SqlDataSource1”不支持插入
【发布时间】:2011-09-02 13:11:17
【问题描述】:

我有问题,

问题是我创建了 asp.net 网站。我正在使用详细信息视图插入记录。

我正在使用访问数据源来连接数据库文件。我收到一个错误,错误是

“/WebSite3”应用程序中的服务器错误。

除非指定了 InsertCommand,否则数据源“SqlDataSource1”不支持插入。 说明:执行当前 Web 请求期间发生未处理的异常。请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息。

异常详细信息:System.NotSupportedException:数据源“SqlDataSource1”不支持插入,除非指定了 InsertCommand。

来源错误:

在执行当前 Web 请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪来识别有关异常起源和位置的信息。

堆栈跟踪:

[NotSupportedException:数据源“SqlDataSource1”不支持插入,除非指定了 InsertCommand。] System.Web.UI.WebControls.SqlDataSourceView.ExecuteInsert(IDictionary 值)+1967663 System.Web.UI.DataSourceView.Insert(IDictionary 值,DataSourceViewOperationCallback 回调)+89 System.Web.UI.WebControls.DetailsView.HandleInsert(String commandArg, Boolean CauseValidation) +379 System.Web.UI.WebControls.DetailsView.HandleEvent(EventArgs e, Boolean CauseValidation, String validationGroup) +574 System.Web.UI.WebControls.DetailsView.OnBubbleEvent(对象源,EventArgs e)+95 System.Web.UI.Control.RaiseBubbleEvent(对象源,EventArgs args)+37 System.Web.UI.WebControls.DetailsViewRow.OnBubbleEvent(对象源,EventArgs e)+112 System.Web.UI.Control.RaiseBubbleEvent(对象源,EventArgs args)+37 System.Web.UI.WebControls.LinkBut​​ton.OnCommand(CommandEventArgs e) +125 System.Web.UI.WebControls.LinkBut​​ton.RaisePostBackEvent(字符串 eventArgument)+169 System.Web.UI.WebControls.LinkBut​​ton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(字符串 eventArgument)+9 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +176 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563


版本信息:Microsoft .NET Framework 版本:4.0.30319; ASP.NET 版本:4.0.30319.225

请帮帮我,

提前致谢

【问题讨论】:

    标签: asp.net


    【解决方案1】:

    您需要为SqlDataSource1指定插入命令和插入参数。

    本文将向您介绍如何使用 SqlDataSource 控件进行插入:

    Inserting with a SqlDataSource control

    【讨论】:

      【解决方案2】:

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-07-17
        • 2018-10-15
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2021-09-13
        相关资源
        最近更新 更多