dbTalk Databases Forums  

Error message with stored procedure

comp.databases.ms-sqlserver comp.databases.ms-sqlserver


Discuss Error message with stored procedure in the comp.databases.ms-sqlserver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
JJ297
 
Posts: n/a

Default Error message with stored procedure - 10-29-2007 , 11:50 AM






Could someone help me, I'm getting this error message:

Procedure or function UpdateResources has too many arguments
specified.

Here's my stored procedure, I am trying to update four columns, two
are in the same table and two are in different tables. Any
suggestions?

CREATE PROCEDURE [UpdateResources]
(@titleID int,
@title varchar (255),
@description varchar (2047),
@quantityowned int)



AS Update Titles

SET

[title]=@title,
[description]=@description

where titleID=@titleid

Update classifications

set

[description]=@description

Update resources

set

[quantityowned]=@quantityowned
GO

I have two columns called description, on in the titles table and one
in the classification table.

Thanks!


Reply With Quote
  #2  
Old   
Plamen Ratchev
 
Posts: n/a

Default Re: Error message with stored procedure - 10-29-2007 , 12:52 PM






This error message appears when you try to call a stored procedure and
supply more parameters than those declared for that procedure. Look at the
code where you call the UpdateResources procedure and check that you pass
the correct parameter list.

HTH,

Plamen Ratchev
http://www.SQLStudio.com




Reply With Quote
  #3  
Old   
JJ297
 
Posts: n/a

Default Re: Error message with stored procedure - 10-29-2007 , 01:06 PM



On Oct 29, 2:52 pm, "Plamen Ratchev" <Pla... (AT) SQLStudio (DOT) com> wrote:
Quote:
This error message appears when you try to call a stored procedure and
supply more parameters than those declared for that procedure. Look at the
code where you call the UpdateResources procedure and check that you pass
the correct parameter list.

HTH,

Plamen Ratchevhttp://www.SQLStudio.com
I've checked everything and can't figure it out. Here's the code on
the other page any suggestions?

<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:TrainUserConnectionString %>"
SelectCommand="GetResourceLibraryInfo"
SelectCommandType="StoredProcedure" UpdateCommand="UpdateResources"
UpdateCommandType="StoredProcedure">
<SelectParameters>
<asp:ControlParameter ControlID="DropDownList1" DefaultValue="1"
Name="Type" PropertyName="SelectedValue"
Type="String" />
</SelectParameters>
<UpdateParameters>
<asp:Parameter Name="titleID" Type="Int32" />
<asp:Parameter Name="title" Type="String" />
<asp:Parameter Name="description" Type="String" />
<asp:Parameter Name="quantityowned" Type="Int32" />
</UpdateParameters>
</asp:SqlDataSource>



Reply With Quote
  #4  
Old   
Plamen Ratchev
 
Posts: n/a

Default Re: Error message with stored procedure - 10-29-2007 , 02:14 PM



I see only the definition for the update parameters, not the actual data
binding. Look at the asp:BoundField tags and make sure the DataField values
are correct and there is no duplication of names. Data bound fields
automatically are added to a collection that gets submitted as parameters.
See more details here:
http://msdn2.microsoft.com/en-us/library/ms228051.aspx

Also, make sure that ConflictDetection (a property of the data source) is
not set to CompareAllValues (it is set to OverwriteChanges by default). If
you have it set to CompareAllValues then two sets of parameters are passed,
one for the updated and one for the original values.

HTH,

Plamen Ratchev
http://www.SQLStudio.com




Reply With Quote
  #5  
Old   
Plamen Ratchev
 
Posts: n/a

Default Re: Error message with stored procedure - 10-29-2007 , 02:19 PM



Forgot to say - a good way to troubleshoot something like this is to use SQL
Profiler to see what SQL statements actually get submitted.

Plamen Ratchev
http://www.SQLStudio.com



Reply With Quote
  #6  
Old   
JJ297
 
Posts: n/a

Default Re: Error message with stored procedure - 10-30-2007 , 05:44 AM



On Oct 29, 4:19 pm, "Plamen Ratchev" <Pla... (AT) SQLStudio (DOT) com> wrote:
Quote:
Forgot to say - a good way to troubleshoot something like this is to use SQL
Profiler to see what SQL statements actually get submitted.

Plamen Ratchevhttp://www.SQLStudio.com
okay Thanks will try that.



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.