У меня возникла проблема, когда я рассчитывал отобразить (Количество * Цена) Как Total FROM ShoppingCart, ему удалось отобразить итоговое значение для всего купленного пользователем товара, но я не смог обновить или удалить в столбце и когда я обновляю его сразу же, выведите мне эту ошибку «Неверный синтаксис рядом с ключевым словом« ГДЕ »»
Я приведу код здесь:
<asp:GridView ID="GridView2" runat="server" AllowPaging="True"
AutoGenerateColumns="False" CellPadding="4"
DataSourceID="SqlDataSource2" ForeColor="#333333" GridLines="None"
AllowSorting="True">
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<RowStyle BackColor="#EFF3FB" />
<Columns>
<asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
<asp:BoundField DataField="ProductID" HeaderText="ProductID"
SortExpression="ProductID" />
<asp:BoundField DataField="UserName" HeaderText="UserName"
SortExpression="UserName" />
<asp:BoundField DataField="InsertDate" HeaderText="InsertDate"
SortExpression="InsertDate" />
<asp:BoundField DataField="Quantity" HeaderText="Quantity"
SortExpression="Quantity" />
<asp:BoundField DataField="Price" HeaderText="Price"
SortExpression="Price" />
<asp:BoundField DataField="OrderID" HeaderText="OrderID"
SortExpression="OrderID" />
<asp:BoundField DataField="Total" HeaderText="Total"
SortExpression="Total" />
</Columns>
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<EditRowStyle BackColor="#2461BF" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource2" runat="server"
ConflictDetection="CompareAllValues"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
DeleteCommand="DELETE FROM [ShoppingCart] WHERE [CartID] = @original_CartID AND [ProductID] = @original_ProductID AND [UserName] = @original_UserName AND [InsertDate] = @original_InsertDate AND [Quantity] = @original_Quantity AND [Price] = @original_Price AND [OrderID] = @original_OrderID AND [Total]= @original_Total"
InsertCommand="INSERT INTO [ShoppingCart] ([ProductID], [UserName], [InsertDate], [Quantity], [Price], [OrderID], [Total]) VALUES (@ProductID, @UserName, @InsertDate, @Quantity, @Price, @OrderID, @Total)"
OldValuesParameterFormatString="original_{0}"
SelectCommand="SELECT [ProductID], [UserName], [InsertDate], [Quantity], [Price], [OrderID], (Quantity * Price) As Total FROM [ShoppingCart]"
UpdateCommand="UPDATE [ShoppingCart] SET [ProductID] = @ProductID, [UserName] = @UserName, [InsertDate] = @InsertDate, [Quantity] = @Quantity, [Price] = @Price, [OrderID] = @OrderID, [Total]= @Total, WHERE [CartID] = @original_CartID AND [ProductID] = @original_ProductID AND [UserName] = @original_UserName AND [InsertDate] = @original_InsertDate AND [Quantity] = @original_Quantity AND [Price] = @original_Price AND [OrderID] = @original_OrderID AND [Total]= @Total">
<DeleteParameters>
<asp:Parameter Name="original_CartID" Type="Int32" />
<asp:Parameter Name="original_ProductID" Type="Int32" />
<asp:Parameter Name="original_UserName" Type="String" />
<asp:Parameter Name="original_InsertDate" Type="DateTime" />
<asp:Parameter Name="original_Quantity" Type="Int32" />
<asp:Parameter Name="original_Price" Type="Decimal" />
<asp:Parameter Name="original_OrderID" Type="Int32" />
<asp:Parameter Name="original_Total" Type="Decimal" />
</DeleteParameters>
<InsertParameters>
<asp:Parameter Name="ProductID" />
<asp:Parameter Name="UserName" />
<asp:Parameter Name="InsertDate" />
<asp:Parameter Name="Quantity" />
<asp:Parameter Name="Price" />
<asp:Parameter Name="OrderID" />
<asp:Parameter Name="Total" />
</InsertParameters>
<UpdateParameters>
<asp:Parameter Name="ProductID" Type="Int32" />
<asp:Parameter Name="UserName" Type="String" />
<asp:Parameter Name="InsertDate" Type="DateTime" />
<asp:Parameter Name="Quantity" Type="Int32" />
<asp:Parameter Name="Price" Type="Decimal" />
<asp:Parameter Name="OrderID" Type="Int32" />
<asp:Parameter Name="Total" Type="Decimal" />
<asp:Parameter Name="original_CartID" Type="Int32" />
<asp:Parameter Name="original_ProductID" Type="Int32" />
<asp:Parameter Name="original_UserName" Type="String" />
<asp:Parameter Name="original_InsertDate" Type="DateTime" />
<asp:Parameter Name="original_Quantity" Type="Int32" />
<asp:Parameter Name="original_Price" Type="Decimal" />
<asp:Parameter Name="original_OrderID" Type="Int32" />
<asp:Parameter Name="original_Total" Type="Decimal" />
</UpdateParameters>
</asp:SqlDataSource>
Помогите мне в этом, я не знаю, что они имеют в виду под ошибкой. Это для администратора, который может обновить или удалить в корзине