<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="costid" DataSourceID="SqlDataSource1">
<Columns>
<asp:CommandField ShowEditButton="True" />
<asp:BoundField DataField="costid" HeaderText="costid" InsertVisible="False" ReadOnly="True" SortExpression="costid" />
<asp:BoundField DataField="dinner_amt" HeaderText="dinner_amt" SortExpression="dinner_amt" />
<asp:BoundField DataField="exhibition_cost" HeaderText="exhibition_cost" SortExpression="exhibition_cost" />
<asp:BoundField DataField="hostess_cost" HeaderText="hostess_cost" SortExpression="hostess_cost" />
<asp:BoundField DataField="Total-area-units" HeaderText="Total-area-units" SortExpression="Total-area-units" />
<asp:BoundField DataField="total-stand-area" HeaderText="total-stand-area" SortExpression="total-stand-area" />
<asp:BoundField DataField="No-of-guests" HeaderText="No-of-guests" SortExpression="No-of-guests" />
<asp:BoundField DataField="No-of-hostess" HeaderText="No-of-hostess" SortExpression="No-of-hostess" />
<asp:BoundField DataField="No-of-guests-units" HeaderText="No-of-guests-units" SortExpression="No-of-guests-units" />
<asp:BoundField DataField="No-of-hostess-units" HeaderText="No-of-hostess-units" SortExpression="No-of-hostess-units" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:credentialConnectionString %>" DeleteCommand="DELETE FROM [Total_expense_cost] WHERE [costid] = @costid" InsertCommand="INSERT INTO [Total_expense_cost] ([dinner_amt], [exhibition_cost], [hostess_cost], [Total-area-units], [total-stand-area], [No-of-guests], [No-of-hostess], [No-of-guests-units], [No-of-hostess-units]) VALUES (@dinner_amt, @exhibition_cost, @hostess_cost, @column1, @column2, @column3, @column4, @column5, @column6)" SelectCommand="SELECT * FROM [Total_expense_cost]" UpdateCommand="UPDATE [Total_expense_cost] SET [dinner_amt] = @dinner_amt, [exhibition_cost] = @exhibition_cost, [hostess_cost] = @hostess_cost, [Total-area-units] = @column1, [total-stand-area] = @column2, [No-of-guests] = @column3, [No-of-hostess] = @column4, [No-of-guests-units] = @column5, [No-of-hostess-units] = @column6 WHERE [costid] = @costid">
<DeleteParameters>
<asp:Parameter Name="costid" Type="Int32" />
</DeleteParameters>
<InsertParameters>
<asp:Parameter Name="dinner_amt" Type="Decimal" />
<asp:Parameter Name="exhibition_cost" Type="Decimal" />
<asp:Parameter Name="hostess_cost" Type="Decimal" />
<asp:Parameter Name="column1" Type="Int32" />
<asp:Parameter Name="column2" Type="Int32" />
<asp:Parameter Name="column3" Type="Int32" />
<asp:Parameter Name="column4" Type="Int32" />
<asp:Parameter Name="column5" Type="Int32" />
<asp:Parameter Name="column6" Type="Int32" />
</InsertParameters>
<UpdateParameters>
<asp:Parameter Name="dinner_amt" Type="Decimal" />
<asp:Parameter Name="exhibition_cost" Type="Decimal" />
<asp:Parameter Name="hostess_cost" Type="Decimal" />
<asp:Parameter Name="column1" Type="Int32" />
<asp:Parameter Name="column2" Type="Int32" />
<asp:Parameter Name="column3" Type="Int32" />
<asp:Parameter Name="column4" Type="Int32" />
<asp:Parameter Name="column5" Type="Int32" />
<asp:Parameter Name="column6" Type="Int32" />
<asp:Parameter Name="costid" Type="Int32" />
</UpdateParameters>
</asp:SqlDataSource>
Just i have row in db. I used gridview. Its throwing error while updating data.