An error occurred.Procedure or function sp_ExpertAddressDelete has too many arguments specified

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
So I have been playing with this issue for two weeks and its beginning to wear on my nerves. Here is the code for the component.
<asp:GridView ID="grdvExpertAddress" runat="server" AutoGenerateColumns="False" Height="100px"
Width="617px" AutoGenerateRows="False" BorderStyle="Groove" BackColor="Beige"
ForeColor="#330099" BorderWidth="5px" Font-Names="Comic Sans MS" Font-Size="Small"
BorderColor="Black" DataSourceID="sqldsExpertAddress"
onrowdatabound="grdvExpertAddress_RowDataBound"
onrowcommand="grdvExpertAddress_RowCommand"
DataKeyNames="Expert_UID,AddressID"
onrowdeleting="grdvExpertAddress_RowDeleting"
onrowdeleted="grdvExpertAddress_RowDeleted
<EmptyDataTemplate>
<asp:LinkButton ID="btnAddAddressRecord" runat="server" OnClick="btnAddAddressRecord_Click Add New Address
</asp:LinkButton>
<asp:Label ID="lblEmptySearch" runat="server No Results Found</asp:Label>
<asp:ModalPopupExtender ID="btnAddAddressRecord_modalpopupextender" runat="server"
Drag="true" DynamicServicePath="" Enabled="False" PopupControlID="pnlAddAddressRecord"
PopupDragHandleControlID="PopupHeader" TargetControlID="btnAddAddressRecord"
BackgroundCssClass="modalBackground" DropShadow="true
</asp:ModalPopupExtender>
</EmptyDataTemplate>
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:LinkButton ID="btnEditAddressRecord" runat="server"
onclick="btnEditAddressRecord_Click
Edit
</asp:LinkButton>
<asp:LinkButton ID="btnDeleteAddressRecord" runat="server" CommandName="Delete
Delete
</asp:LinkButton>
</ItemTemplate>
<EditItemTemplate>
<asp:LinkButton ID="btnUpdateAddressRecord" runat="server" Text="Update"
CommandName="Update" />
<asp:LinkButton ID="btnCancelAddressRecord" runat="server" Text="Cancel" CommandName="Cancel" />
</EditItemTemplate>
<HeaderTemplate>
<asp:LinkButton ID="btnAddAddressRecord" runat="server" OnClick="btnAddAddressRecord_Click Add New Address
</asp:LinkButton>
<asp:ModalPopupExtender ID="btnAddAddressRecord_modalpopupextender" runat="server"
Drag="true" DynamicServicePath="" Enabled="False" PopupControlID="pnlAddAddressRecord"
PopupDragHandleControlID="PopupHeader" TargetControlID="btnAddAddressRecord"
BackgroundCssClass="modalBackground" DropShadow="true
</asp:ModalPopupExtender>
</HeaderTemplate>
</asp:TemplateField>
<asp:BoundField DataField="Expert_UID" HeaderText="Expert_UID" InsertVisible="False"
ReadOnly="True" SortExpression="Expert_UID" Visible="False" />
<asp:BoundField DataField="AddressID" HeaderText="AddressID" InsertVisible="False"
ReadOnly="True" SortExpression="AddressID" Visible="False" />
<asp:TemplateField HeaderText="Address1" SortExpression="Address1
<EditItemTemplate>
<asp:TextBox ID="txtAddress1" runat="server" Text=<%# Bind("Address1") %>></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="lbladdress1" runat="server" Text=<%# Bind("Address1") %>></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Address2" SortExpression="Address2
<EditItemTemplate>
<asp:TextBox ID="txtAddress2" runat="server" Text=<%# Bind("Address2") %>></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="lblAddress2" runat="server" Text=<%# Bind("Address2") %>></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="City" SortExpression="City
<ItemTemplate>
<asp:Label ID="lblCity" runat="server" Text=<%# Bind("City") %>></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="State" SortExpression="State
<ItemTemplate>
<asp:Label ID="lblState" runat="server" Text=<%# Bind("State") %>></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Zip" SortExpression="Zip
<ItemTemplate>
<asp:Label ID="lblZipCode" runat="server" Text=<%# Bind("Zip") %>></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="County Name" SortExpression="CountyName
<ItemTemplate>
<asp:Label ID="lblCountyName" runat="server" Text=<%# Bind("CountyName") %>></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Zip_UID" SortExpression="Zip_UID" Visible="False
<EditItemTemplate>
<asp:DropDownList ID="ddlZipCode" runat="server" AutoPostBack="false" DataSourceID="sqldsZipCode"
DataTextField="FullOut" DataValueField="Zip_UID" Width="250px" OnSelectedIndexChanged="ddlZipCode_SelectedIndexChanged
</asp:DropDownList>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label3" runat="server" Text=<%# Bind("Zip_UID") %>></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="AddressType_UID"
SortExpression="AddressType_UID" Visible="False
<EditItemTemplate>
<asp:DropDownList ID="ddlMailType" runat="server" DataSourceID="sqldsAddressType"
AutoPostBack="false" DataTextField="AddressTypeDesc" DataValueField="AddressType_UID"
Width="150px
</asp:DropDownList>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Address Type"
SortExpression="AddressTypeDesc
<ItemTemplate>
<asp:Label ID="lblAddressTypeDesc" runat="server" Text=<%# Bind("AddressTypeDesc") %>></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:DropDownList ID="ddlMailType" runat="server" DataSourceID="sqldsAddressType"
AutoPostBack="false" DataTextField="AddressTypeDesc" DataValueField="AddressType_UID"
Width="150px
</asp:DropDownList>
</EditItemTemplate>
</asp:TemplateField>
</Columns>
<HeaderStyle BackColor="#990000" Font-Bold="True" Font-Names="Comic Sans MS" Font-Size="Small"
ForeColor="#FFFFCC" Width="100px" />
<AlternatingRowStyle BackColor="#FFFF66" />
</asp:GridView>

Stored procedure
ALTER PROCEDURE dbo.sp_ExpertAddressDelete
--@iExpert_UID int,
@iAddressID int

AS
DELETE FROM Expert_Address
WHERE (AddressID = @iAddressID) --AND (Expert_UID = @iExpert_UID)
RETURN
<asp:SqlDataSource ID="sqldsExpertAddress" runat="server" ConnectionString="<%$ ConnectionStrings:MedexSQLConnection %>"
SelectCommand="sp_ExpertAddressGet" SelectCommandType="StoredProcedure"
UpdateCommand="sp_ExpertAddressUpdate" UpdateCommandType="StoredProcedure"
DeleteCommand="sp_ExpertAddressDelete" DeleteCommandType="StoredProcedure
<SelectParameters>
<asp:ControlParameter ControlID="cmbxExperts" DefaultValue="0" Name="iExpert_UID"
PropertyName="SelectedValue" Type="Int32" />
</SelectParameters>
<DeleteParameters>
<asp:Parameter Name="iAddressID" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="iExpert_UID" Type="Int32" />
<asp:Parameter Name="iAddressID" Type="Int32" />
<asp:Parameter Name="iAddressType_UID" Type="Int32" />
<asp:Parameter Name="vAddress1" Type="String" />
<asp:Parameter Name="vAddress2" Type="String" />
<asp:Parameter Name="iZip_UID" Type="Int32" />
</UpdateParameters>
</asp:SqlDataSource> protected void grdvExpertAddress_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
try
{
//int tempExpert_UID = Convert.ToInt32(grdvExpertAddress.DataKeys[e.RowIndex].Values[0]);
int tempAddressID = Convert.ToInt32(grdvExpertAddress.DataKeys[e.RowIndex].Values[1]);


//sqldsExpertAddress.DeleteParameters["iExpert_UID"].DefaultValue = tempExpert_UID.ToString();
sqldsExpertAddress.DeleteParameters["iAddressID"].DefaultValue = tempAddressID.ToString();

sqldsExpertAddress.Delete();
}
catch (Exception ex)
{
Debug.WriteLine("Exception Message: " + ex.Message);
}
}
protected void grdvExpertAddress_RowDeleted(object sender, GridViewDeletedEventArgs e)
{
try
{
grdvExpertAddress.DataBind();

this.updtpnlAddAddressRecord.Update();
}
catch (Exception ex)
{
Debug.WriteLine("Exception Message: " + ex.Message);
}
}
The update panel is standard and functions correctly when adding a record and the gridview component that the above coded SQL data component is bound to updates properly. The record is removed from the database, however the updatepanel is somehow generating this error when updating.
Any help is appreciated


View the full article
 
Back
Top