This is a migrated thread and some comments may be shown as answers.

Deleting on Hierarchical Grid

1 Answer 87 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Erminio
Top achievements
Rank 1
Erminio asked on 26 Oct 2018, 03:21 PM

Hi all,

I had same problems with delete command on hierarchical grid. I think the problem it's caused by different declaration between DataKeyNames in grid and DeleteParameters in SqlDataSource.

Here is my code

 <MasterTableView DataSourceID="SqlDataSource1" DataKeyNames="VersamentoId" AllowMultiColumnSorting="True"<br>                                        Width="100%" CommandItemDisplay="Top" Name="Versamenti" EditMode="Batch"><br>                                        <DetailTables><br>                                            <telerik:GridTableView DataKeyNames="VersamentoId,ConsumoID" DataSourceID="SqlDataSource2" Width="80%" AllowAutomaticDeletes="true" AllowFilteringByColumn="false" AllowAutomaticInserts="true" AllowAutomaticUpdates="true"<br>                                                runat="server" CommandItemDisplay="Bottom" Name="Consumi" BorderColor="Navy" BorderStyle="Solid" BorderWidth="2" EditMode="Batch"><br>                                                <ParentTableRelation><br>                                                    <telerik:GridRelationFields DetailKeyField="VersamentoId" MasterKeyField="VersamentoId"></telerik:GridRelationFields><br>                                                </ParentTableRelation>

.....

<p><asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:iRoncadin %>"<br>            DeleteCommand="[dbo].[mes_spDeleteConsumoDaProduzione]" DeleteCommandType="StoredProcedure"<br>            InsertCommand="RO_Portal_SP_InsertConsumoDaProduzione" InsertCommandType="StoredProcedure"<br>            SelectCommand="SELECT<br>                                   mwcpp.ID as ConsumoID<br>                                 , mwcpp.DocEntryOP<br>                                 , mwcpp.DocEntryFather<br>                                 , mwcpp.U_WordCode<br>                                 , mwcpp.U_OprCode<br>                                 , mwcpp.ItemCode<br>                                 , mwcpp.U_Revision<br>                                 , mwcpp.Quantity<br>                                 , mwcpp.Status<br>                                 , mwcpp.CreateDate<br>                                 , mwcpp.UpdateDate<br>                                 , mwcpp.DestDocEntry<br>                                 , mwcpp.DestLineNum<br>                                 , mwcpp.AlternativeCode<br>                                 , mwcpp.TipologiaId<br>                                 , mwcpp.VersamentoId<br>                            FROM dbo.MES_wsConsumoPerProduzione mwcpp where VersamentoId = @VersamentoId"<br>            UpdateCommand="UPDATE dbo.MES_wsConsumoPerProduzione<br>                            SET <br>                                DocEntryOP = @DocEntryOP<br>                                , DocEntryFather = @DocEntryFather<br>                                , U_WordCode = @U_WordCode<br>                                , U_OprCode = @U_OprCode<br>                                , ItemCode = @ItemCode<br>                                , Quantity = @Quantity<br>                                , AlternativeCode = @AlternativeCode<br>                            WHERE ID = @ConsumoID"<br>            ProviderName="<%$ ConnectionStrings:iRoncadin.ProviderName %>"><br>            <SelectParameters><br>                <asp:Parameter Name="VersamentoId" Type="Int32"></asp:Parameter><br>            </SelectParameters><br>            <DeleteParameters><br>                <asp:Parameter Name="ConsumoID" Type="Int32"></asp:Parameter><br>            </DeleteParameters></p><p></p>

The stored procedure called to delete the row of first child grid is this

[dbo].[mes_spDeleteConsumoDaProduzione]   @ID INT

 

but, as you can see, DataKeyNames in first child grid are VersamentoId,ConsumoID. This is done because VersamentoId is the correlation key with parent grid and ConsumoId is the correlation key with another child grid.

When I try to delete a row of first child grid, system return the following error

Procedure or function mes_spDeleteConsumoDaProduzione has too many arguments specified.

 

Anyone knows a solution to bring together hierarchical grids and delete of child rows?

Thanks a lot

1 Answer, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 31 Oct 2018, 12:29 PM
Hi Erminio,

You may want to take a look at the following discussion on the matter: Procedure or function has too many arguments specified error.
 
Regards,
Rumen
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Grid
Asked by
Erminio
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Share this question
or