Re: Procedure or function has too many arguments specified

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



It sounds like something isn't being cleared from the parameters collection
for the delete command but I can't be sure. Did you loop through the
SqlErrors collection?
"Mike" <newbie@xxxxxxxxxx> wrote in message
news:eT1AweG$GHA.1784@xxxxxxxxxxxxxxxxxxxxxxx
Thanks for the response. I'm running Express, but I'm expecting an
evalutation copy of the full product to turn up any day. Hopefully that
has the tools for what I need to do.

The maddening thing is that I've since created a number of other pages in
exactly the same way, and they all work correctly. I tried renaming the
offending proc, deleting the datasource and then creating a new one
attaching the renamed proc. No change though. I deleted the proc, then
recreated it. No joy.

I suppose I could try deleting the page, all related procs and then start
again, but I really would like to know why this one is acting up.

Mike


"W.G. Ryan [MVP]" <WilliamRyan@xxxxxxxxxxxxxxxx> wrote in message
news:eaxnwYF$GHA.3312@xxxxxxxxxxxxxxxxxxxxxxx
Mike, I'd run a trace on Sql Server and run it. See what params are
actually being passed in, this should give you a clue as to what the
problem is.
"Mike" <newbie@xxxxxxxxxx> wrote in message
news:uOVCrzs%23GHA.5092@xxxxxxxxxxxxxxxxxxxxxxx
I posted this is m.p.d.f.aspnet last night, but got no useful response.
I have also googled this group (and a lot of others), and have not found
a satisfactory explanation.

I have a stored proc with one parameter:

CREATE PROCEDURE [dbo].[qDeleteAgencyDetails]
@AgencyID int
AS
BEGIN
SET NOCOUNT ON;
DELETE FROM Agency WHERE AgencyID = @AgencyID
END

I use a dropdownlist to select an option which is displayed in a
Formview, which has an associated SqlDataSource with
SELECT/INSERT/UPDATE and DELETE commands specified. The control
parameters for the commands are identical:

<UpdateParameters>
...
<asp:ControlParameter
ControlID="ddlAgencyList"
Name="AgencyID"
PropertyName="SelectedValue"
Type="Int32" />
</UpdateParameters>
<SelectParameters>
<asp:ControlParameter
ControlID="ddlAgencyList"
Name="AgencyID"
PropertyName="SelectedValue"
Type="Int32" />
</SelectParameters>
<DeleteParameters>
<asp:ControlParameter
ControlID="ddlAgencyList"
Name="AgencyID"
PropertyName="SelectedValue"
Type="Int32" />
<DeleteParameters>

The SELECT, INSERT and UPDATE work as expected, but the DELETE throws
the exception (in the subject). I've got no code-behind interfering.
The whole thing is wired up declaratively at the moment.

I used the wizard to configure the DataSource, and selected the
appropriate procs. I manually applied the UPDATE and DELETE
ControlParameters, copying and pasting the value given by the wizard for
the SELECT ControlParameter. (Why DOES the wizard duplicate the controls
in the parameter drop-down list?!?) The DELETE stored proc runs fine
through SSMS. Other pages that follow exactly the same format as this
one (although they deal with different, but similarly structured tables)
work fine in all respects.

I have changed the Delete CommandType to Text, and gave the CommandText
value as "DELETE FROM Agency WHERE AgencyID = @AgencyID". The page
works fine now, so while I guess I have got round my problem, I still
don't know what the problem was.

Is there some bug in the way that VS2005 or VWD configures
SqlDatasources? It obviously aint right, otherwise it wouldn't list
controls twice in the parameter configuration dop-down.

Mike








.



Relevant Pages

  • Procedure or function has too many arguments specified
    ... DELETE FROM Agency WHERE AgencyID = @AgencyID ... The control parameters for the commands are identical: ... I used the wizard to configure the DataSource, ... otherwise it wouldn't list controls twice in the ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Procedure or function has too many arguments specified
    ... DELETE FROM Agency WHERE AgencyID = @AgencyID ... The control parameters for the commands are ... I used the wizard to configure the DataSource, ... otherwise it wouldn't list controls twice in the ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Procedure or function has too many arguments specified
    ... attaching the renamed proc. ... DELETE FROM Agency WHERE AgencyID = @AgencyID ... The control parameters for the commands ... controls twice in the parameter configuration dop-down. ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Silent overriding of the command (reopened)
    ... >> commands, it's a fairly simple matter to confine them to a modified ... which is to make Tcl a better product for all potential users. ... that call pfoo, after you've had to `proc pfoo2` to fix the `pits`... ...
    (comp.lang.tcl)
  • Re: Dict sharing vs. duplication
    ... each value that is passed as an argument to a proc: one by the caller, ... one by the proc itself. ... features of Tcl is that all commands are equal, ... But [dict] may actually improve the situation because a dict name will ...
    (comp.lang.tcl)