Note that there are some explanatory texts on larger screens.

plurals
  1. POInput string was not in a correct format error display when I delete data in GridView DB
    text
    copied!<p>When I update the quantity in my shopping cart, the price changes to a dollar sign and everything was and the total also changed. Ok, but then when I press the delete button it shows this error:</p> <pre><code>Input string was not in a correct format </code></pre> <p>How can solve it? Here I provide the code:</p> <pre><code> &lt;asp:GridView ID="GridView2" runat="server" AllowPaging="True" AutoGenerateColumns="False" CellPadding="4" DataSourceID="SqlDataSource2" ForeColor="#333333" GridLines="None" AllowSorting="True" DataKeyNames="CartID"&gt; &lt;FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" /&gt; &lt;RowStyle BackColor="#EFF3FB" /&gt; &lt;Columns&gt; &lt;asp:CommandField ShowDeleteButton="True" ShowEditButton="True" /&gt; &lt;asp:BoundField DataField="CartID" HeaderText="CartID" SortExpression="CartID" InsertVisible="False" ReadOnly="True" /&gt; &lt;asp:BoundField DataField="ProductID" HeaderText="ProductID" SortExpression="ProductID" /&gt; &lt;asp:BoundField DataField="UserName" HeaderText="UserName" SortExpression="UserName" /&gt; &lt;asp:BoundField DataField="InsertDate" HeaderText="InsertDate" SortExpression="InsertDate" /&gt; &lt;asp:BoundField DataField="Quantity" HeaderText="Quantity" SortExpression="Quantity" /&gt; &lt;asp:BoundField DataField="Price" DataFormatString="{0:c}" HeaderText="Price" SortExpression="Price" /&gt; &lt;asp:BoundField DataField="OrderID" HeaderText="OrderID" SortExpression="OrderID" /&gt; &lt;asp:BoundField DataField="Total" DataFormatString="{0:c}" HeaderText="Total" SortExpression="Total" /&gt; &lt;/Columns&gt; &lt;PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" /&gt; &lt;SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" /&gt; &lt;HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" /&gt; &lt;EditRowStyle BackColor="#2461BF" /&gt; &lt;AlternatingRowStyle BackColor="White" /&gt; &lt;/asp:GridView&gt; &lt;asp:SqlDataSource ID="SqlDataSource2" runat="server" ConflictDetection="CompareAllValues" ConnectionString="&lt;%$ ConnectionStrings:ConnectionString %&gt;" DeleteCommand="DELETE FROM [ShoppingCart] WHERE [CartID] = @original_CartID AND (([ProductID] = @original_ProductID) OR ([ProductID] IS NULL AND @original_ProductID IS NULL)) AND (([UserName] = @original_UserName) OR ([UserName] IS NULL AND @original_UserName IS NULL)) AND (([InsertDate] = @original_InsertDate) OR ([InsertDate] IS NULL AND @original_InsertDate IS NULL)) AND (([Quantity] = @original_Quantity) OR ([Quantity] IS NULL AND @original_Quantity IS NULL)) AND (([Price] = @original_Price) OR ([Price] IS NULL AND @original_Price IS NULL)) AND (([OrderID] = @original_OrderID) OR ([OrderID] IS NULL AND @original_OrderID IS NULL))" InsertCommand="INSERT INTO [ShoppingCart] ([ProductID], [UserName], [InsertDate], [Quantity], [Price], [OrderID]) VALUES (@ProductID, @UserName, @InsertDate, @Quantity, @Price, @OrderID)" OldValuesParameterFormatString="original_{0:c}" SelectCommand="SELECT [CartID], [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 WHERE [CartID] = @original_CartID AND (([ProductID] = @original_ProductID) OR ([ProductID] IS NULL AND @original_ProductID IS NULL)) AND (([UserName] = @original_UserName) OR ([UserName] IS NULL AND @original_UserName IS NULL)) AND (([InsertDate] = @original_InsertDate) OR ([InsertDate] IS NULL AND @original_InsertDate IS NULL)) AND (([Quantity] = @original_Quantity) OR ([Quantity] IS NULL AND @original_Quantity IS NULL)) AND (([Price] = @original_Price) OR ([Price] IS NULL AND @original_Price IS NULL)) AND (([OrderID] = @original_OrderID) OR ([OrderID] IS NULL AND @original_OrderID IS NULL))"&gt; &lt;DeleteParameters&gt; &lt;asp:Parameter Name="original_CartID" Type="Int32" /&gt; &lt;asp:Parameter Name="original_ProductID" Type="Int32" /&gt; &lt;asp:Parameter Name="original_UserName" Type="String" /&gt; &lt;asp:Parameter Name="original_InsertDate" Type="DateTime" /&gt; &lt;asp:Parameter Name="original_Quantity" Type="Int32" /&gt; &lt;asp:Parameter Name="original_Price" Type="Decimal" /&gt; &lt;asp:Parameter Name="original_OrderID" Type="Int32" /&gt; &lt;/DeleteParameters&gt; &lt;InsertParameters&gt; &lt;asp:Parameter Name="ProductID" Type="Int32" /&gt; &lt;asp:Parameter Name="UserName" Type="String" /&gt; &lt;asp:Parameter Name="InsertDate" Type="DateTime" /&gt; &lt;asp:Parameter Name="Quantity" Type="Int32" /&gt; &lt;asp:Parameter Name="Price" Type="Decimal" /&gt; &lt;asp:Parameter Name="OrderID" Type="Int32" /&gt; &lt;/InsertParameters&gt; &lt;UpdateParameters&gt; &lt;asp:Parameter Name="ProductID" Type="Int32" /&gt; &lt;asp:Parameter Name="UserName" Type="String" /&gt; &lt;asp:Parameter Name="InsertDate" Type="DateTime" /&gt; &lt;asp:Parameter Name="Quantity" Type="Int32" /&gt; &lt;asp:Parameter Name="Price" Type="Double" /&gt; &lt;asp:Parameter Name="OrderID" Type="Int32" /&gt; &lt;asp:Parameter Name="original_CartID" Type="Int32" /&gt; &lt;asp:Parameter Name="original_ProductID" Type="Int32" /&gt; &lt;asp:Parameter Name="original_UserName" Type="String" /&gt; &lt;asp:Parameter Name="original_InsertDate" Type="DateTime" /&gt; &lt;asp:Parameter Name="original_Quantity" Type="Int32" /&gt; &lt;asp:Parameter Name="original_Price" Type="Decimal" /&gt; &lt;asp:Parameter Name="original_OrderID" Type="Int32" /&gt; &lt;/UpdateParameters&gt; &lt;/asp:SqlDataSource&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload