Procedure or function has too many arguments specified. Problem

S

sun919

hi there... i ve a little question asking concerning saving data into
database
Basically, I have stored procedure name InsertquestionnaireList and the
argument for this is both correct
... I have a function which run this stored procedure.. All of these are
illustrated below, i dont know what i did wrong cause it should in theory
work fine sine i didnt have sp_name as the store procedure name

please help
many thanks
sun

FOR STORE PROCEDURE

ALTER PROCEDURE dbo.InsertQuestionnaireList

@HNID int, @register datetime, @TypeID int, @questionList int out
AS
SET NOCOUNT OFF;

insert into QuestionnaireList(HNID,questionnaireTypeID,
Register)
values (@HNID,@TypeID,@Register);

set @questionList = Scope_Identity();

FOR FUNCTION THAT RUN STORE PROCEDURE

sqlcmd.CommandText = "InsertQuestionnaireList";
sqlcmd.CommandType = System.Data.CommandType.StoredProcedure;

sqlcmd.Parameters.Add("@HNID", System.Data.SqlDbType.Int ).Value
= id ;
sqlcmd.Parameters.Add("@TypeID", System.Data.SqlDbType.Int).Value
= Convert.ToInt32(type);
sqlcmd.Parameters.Add("@register", System.Data.SqlDbType.DateTime)
Value = register ;
sqlcmd.Parameters.Add("@questionList", System.Data.SqlDbType.Int).
Value = 1;
sqlcmd.Parameters["@questionList"].Direction = System.Data.
ParameterDirection.Output;

con.Open();
sqlcmd.ExecuteNonQuery(); //error here when i execute this

thanks again in advance
 
M

Marc Gravell

The creation of sqlcmd isn't shown; is it new at the time of the cited code?
Is it possible it has parameters from a previous method call, that need
Clear()ing?

Also - is it possible that there is another (older, less params) version of
the SP in the account making the call? (typically the developer NT account
in debug mode) - i.e. is there a
[yourdomain\yourself].InsertQuestionnaireList that needs to be DROPped?

Marc
 
S

sun919 via DotNetMonster.com

Thanks Mark
i forgot to clear the parameter since i reuse it
thanks again
sun



Marc said:
The creation of sqlcmd isn't shown; is it new at the time of the cited code?
Is it possible it has parameters from a previous method call, that need
Clear()ing?

Also - is it possible that there is another (older, less params) version of
the SP in the account making the call? (typically the developer NT account
in debug mode) - i.e. is there a
[yourdomain\yourself].InsertQuestionnaireList that needs to be DROPped?

Marc
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top