Click here to Skip to main content
15,915,828 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Procedure or function expects parameter that was not supplied why it arise and if arise how to resolve it
Posted
Comments
Prasad_Kulkarni 4-Jun-12 7:36am    
Not clear.
Muralikrishna8811 4-Jun-12 7:40am    
Hi
check your code
are you passing all parameters or not?

in your store procedure or function give your parameter to default value. so when you don't supplied it will not ariase error.

example:-

SQL
create procedure procName
 @QryType int=0
 
Share this answer
 
Comments
Prasad_Kulkarni 14-Jun-12 3:31am    
countered!
Hi,

if you are executing your storedprocedure or function, it may required some parameter information to be passed. if you are not passing SqlParameter then it will throw such exception.

you have not given more information but please see below code, this may be your problem.

C#
SqlConnection conn = null;
SqlDataReader rdr  = null;
conn = new SqlConnection("YourConnectionString");
conn.Open();

SqlCommand cmd  = new SqlCommand("StoredProcedureName", conn);
           
cmd.CommandType = CommandType.StoredProcedure;

/* As you can see if your comment below code and if you have CustomerID as parameter in your Stored procedure then it will gives you exception. */
//cmd.Parameters.Add(new SqlParameter("@CustomerID", custId));
rdr = cmd.ExecuteReader();


Please see above code. (Specially comment.)

Thanks
-Amit.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900