my first guess is this:
you are connected to another database, aka where the procedure has less parameters.
please double-check
Main Topics
Browse All TopicsUsing VS 2005 (VB.NET) + Sql Server 2008..
This has me pulling my hair out
My call to a "Insert Row" stored procedure from VB.Net
'''New Stored Procedure
cmd.CommandType = CommandType.StoredProcedur
cmd.CommandText = "sortDetailInsertw"
With cmd.Parameters
.AddWithValue("@iInvoiceId
.AddWithValue("@dPrice", lnPrice)
.AddWithValue("@iQuantity"
.AddWithValue("@iSort", lnID) 'foreign key
.AddWithValue("@dTaxTotal"
.AddWithValue("@dLineTotal
.AddWithValue("@iBinNum", lnBinNumber2) 'foreign key
.AddWithValue("@addedBy", lEmployeeID)
End With
cmd.Connection = con
cmd.ExecuteNonQuery()
cmd.Dispose()
con.Close()
My stored procedure looks like this..
.ALTER PROCEDURE [dbo].[sortDetailInsertw]
(@iInvoiceId int,
@dPrice money,
@iQuantity int,
@iSort int,
@dTaxTotal money,
@dLineTotal money,
@iBinNum int,
@addedBy int)
AS
SET NOCOUNT ON
INSERT INTO tInvDetail
( iInvoiceId,
dPrice,
iQuantity,
iSort,
dTaxTotal,
dLineTotal,
iBinNum,
addedBy)
Values
(@iInvoiceId,
@dPrice,
@iQuantity,
@iSort,
@dTaxTotal,
@dLineTotal,
@iBinNum,
@addedBy)
I notice in my parameters list is shows a return integer..
Anyway I get Procedure has too many arguments error..
Any help or insight would be much appreciated!!
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Dropped the SP and then realized further up in my code I had another call to a SP
I had
Dim cmd As New SqlCommand
and I was using it for both calls to 2 different SP
'SP1
cmd.CommandType = CommandType.StoredProcedur
cmd.CommandText = "sortinsert"
'SP2
cmd.CommandType = CommandType.StoredProcedur
cmd.CommandText = "sortDetailRows"
so I declared
Dim cmd1 As New SqlCommand
and then changed the code...
'SP2
cmd1.CommandType = CommandType.StoredProcedur
cmd1.CommandText = "sortDetailRows"
and low and behold it works...
so I
Business Accounts
Answer for Membership
by: aneeshattingalPosted on 2009-11-05 at 13:15:46ID: 25754124
cmd.CommandType = CommandType.StoredProcedur e
cmd.CommandText = "dbo.sortDetailInsertw"