Advertisement

07.16.2008 at 01:04AM PDT, ID: 23568755
[x]
Attachment Details

Procedure or function <stored procedure> has too many arguments specified.

Asked by G0ggy in Microsoft Visual Basic.Net, SQL Server 2005

Tags: T-SQL, SQL, SQL Server 2005, VB.NET

Hi all,

I have done a search on EE and there are numerous subjects on this problem. I have read a number of them and nothing which they say causes this problem seems apparent in my, very simple, code and stored procedure.

Could a fresh pair of eyes look over this and see if there is anything glaring I have missed?

TIA.Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
Public Function addRole(ByVal roleName As String, ByVal roleWeighting As Integer, ByVal roleStatus As Integer, ByVal userID As Integer) As Boolean
        Dim con As New SqlConnection(ConnectionStrings("dev").ConnectionString)
        Dim cmd As New SqlCommand("sp_addRole", con)
        cmd.CommandType = CommandType.StoredProcedure
 
        cmd.Parameters.AddWithValue("@roleName", roleName)
        cmd.Parameters.AddWithValue("@roleWeighting", roleWeighting)
        cmd.Parameters.AddWithValue("@roleStatus", roleStatus)
        cmd.Parameters.AddWithValue("@userID", userID)
 
        Dim result As Boolean = False
        Try
            con.Open()
            cmd.ExecuteNonQuery()
            result = True
        Catch ex As Exception
            JCBSecurity.logEntry(ex.Message, "Class: roles", "Procedure: addRole", roleName, roleWeighting, roleStatus, userID)
            result = False
        Finally
            con.Close()
        End Try
 
        Return result
    End Function
 
PROCEDURE sp_addRole
	-- Add the parameters for the stored procedure here
	@roleName varchar(50),
	@roleWeighting int,
	@roleStatus int,
	@userID int
AS
BEGIN try
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;
 
    -- Insert statements for procedure here
	declare @dtStamp datetime
 
	set @dtStamp = getdate()
 
	insert into dbo.usr_roles (
		RoleName,
		RoleWeighting,
		RoleStatus,
		DateCreated,
		CreatedBy) values (
		@roleName,
		@roleWeighting,
		@roleStatus,
		@dtStamp,
		@userID)
 
	-- Log it
	Exec dbo.sp_logEntry 'New Role Added', @userID, @roleName, @roleWeighting, @roleStatus
END try
 
begin catch
	If @@TRANCOUNT > 0
		ROLLBACK
 
	-- Error log entry
	Declare @errMsg nvarchar(4000), @errSeverity int, @errProcedure nvarchar(4000), @errLine int
 
	Select @errMsg = ERROR_MESSAGE(), 
		@errSeverity = ERROR_SEVERITY(), 
		@errProcedure = ERROR_PROCEDURE(),
		@errLine = ERROR_LINE()
 
	Exec dbo.sp_logEntry 'SYSTEM ERROR', @errMsg, @errSeverity, @errProcedure, @errLine
end catch
[+][-]07.16.2008 at 01:07AM PDT, ID: 22014034

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.16.2008 at 01:09AM PDT, ID: 22014045

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.16.2008 at 01:11AM PDT, ID: 22014053

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.16.2008 at 07:28AM PDT, ID: 22016251

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.16.2008 at 07:36AM PDT, ID: 22016333

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.16.2008 at 07:44AM PDT, ID: 22016427

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.21.2008 at 12:35AM PDT, ID: 22048542

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.21.2008 at 01:49AM PDT, ID: 22048837

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.22.2008 at 12:08AM PDT, ID: 22056943

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Microsoft Visual Basic.Net, SQL Server 2005
Tags: T-SQL, SQL, SQL Server 2005, VB.NET
Sign Up Now!
Solution Provided By: G0ggy
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628