首页 新闻 会员 周边

应用程序中的服务器错误

0
[已关闭问题]
<h2><em>除非指定了 UpdateCommand,否则数据源&ldquo;SqlDataSource1&rdquo;不支持更新操作。</em> </h2> <p><span style="font-family: Arial, Helvetica, Geneva, SunSans-Regular, sans-serif;"><strong><span style="font-family: Verdana;">说明: </span></strong>执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 <br /><br /><strong><span style="font-family: Verdana;">异常详细信息: </span></strong>System.NotSupportedException: 除非指定了 UpdateCommand,否则数据源&ldquo;SqlDataSource1&rdquo;不支持更新操作。<br /><br /><strong><span style="font-family: Verdana;">源错误:</span></strong> <br /><br /> <table border="0" width="100%" bgcolor="#ffffcc"> <tbody> <tr> <td><code>执行当前 Web 请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪信息确定有关异常原因和发生位置的信息。</code> </td> </tr> </tbody> </table> <br /><strong><span style="font-family: Verdana;">堆栈跟踪:</span></strong> <br /><br /> <table border="0" width="100%" bgcolor="#ffffcc"> <tbody> <tr> <td><code> <pre>[NotSupportedException: 除非指定了 UpdateCommand,否则数据源&ldquo;SqlDataSource1&rdquo;不支持更新操作。] System.Web.UI.WebControls.SqlDataSourceView.ExecuteUpdate(IDictionary keys, IDictionary values, IDictionary oldValues) +1826099 System.Web.UI.DataSourceView.Update(IDictionary keys, IDictionary values, IDictionary oldValues, DataSourceViewOperationCallback callback) +78 System.Web.UI.WebControls.GridView.HandleUpdate(GridViewRow row, Int32 rowIndex, Boolean causesValidation) +1215 System.Web.UI.WebControls.GridView.HandleEvent(EventArgs e, Boolean causesValidation, String validationGroup) +858 System.Web.UI.WebControls.GridView.OnBubbleEvent(Object source, EventArgs e) +95 System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35 System.Web.UI.WebControls.GridViewRow.OnBubbleEvent(Object source, EventArgs e) +117 System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35 System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e) +115 System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument) +163 System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +174 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102</pre> </code></td> </tr> </tbody> </table> </span></p>
顺其自然的主页 顺其自然 | 初学一级 | 园豆:200
提问于:2009-02-19 09:31
< >
分享
其他回答(1)
0

-,-  貌似SqlDataSource控件都不会用吧。。。

wuwukun | 园豆:110 (初学一级) | 2009-02-19 09:40
0

你在SqlDataSource1里把UpdateCommand属性加上就可以了,

如果懒得写,可以自动生成啊。在SqlDataSource1上点配置数据源,最后点上自动生成更新和删除语句

不过实际开发中,是不会用到这些的。

Mervin | 园豆:240 (菜鸟二级) | 2009-02-20 15:03
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册