我想在Gridview(ASP.net)中执行UPDATE操作。我创建了一个AccessDataSource并包含了所有的查询。 删除,请选择查询的工作很好,但不是UPDATEGridview - 更新异常
我得到的错误“在Update语句语法错误”。我的查询是
UPDATE RateCenters SET RateCenterName = @RateCenterName,
State/Province = @State/Province, Quantity/Threshold = @Quantity/Threshold
WHERE RateCenterID = @RateCenterID
我从网站意识到,“[]”应该如果查询包含特殊字符,如“/”
所以我已经改变了查询
UPDATE RateCenters SET [RateCenterName] = [RateCenterName], [State/Province] = [State/Province], [Quantity/Threshold] = [Quantity/Threshold] WHERE RateCenterID = RateCenterID.
使用现在我没有得到UPDATE动作的任何错误,但数据没有得到更新
这是我的html代码
<asp:AccessDataSource ID="AccessDataSource1" runat="server"
DataFile="~/App_Data/db1.mdb" SelectCommand="SELECT * FROM RateCenters"
DeleteCommand="DELETE FROM RateCenters WHERE RateCenterID = @RateCenterID"
InsertCommand="INSERT INTO RateCenters ([RateCenterID], [RateCenterName], [State/Province], [Quantity/Threshold]) VALUES ([RateCenterID], [RateCenterName], [State/Province], [Quantity/Threshold])"
UpdateCommand="UPDATE RateCenters SET RateCenterName = @RateCenterName, State[/]Province = @State[/]Province, Quantity[/]Threshold = Quantity[/]Threshold WHERE RateCenterID = @RateCenterID">
</asp:AccessDataSource>
请让我知道这个问题
感谢
阿琼
这些州/省和数量/阈值列名是? – 2012-02-15 11:29:03
请参阅http://support.microsoft.com/kb/826763 – Fionnuala 2012-02-15 11:36:03
@ Thit Lwin Oo:是的州/省和数量/阈值是列名,我很难现在改变它..客户的任务 – 2012-02-15 11:48:51