Click here to Skip to main content
15,889,116 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
"Procedure or function UpdHtlPrfCRS has too many arguments specified."
i m using the storedprocedure named as UpdHtlPrfCRS and passing the same number of parameters on the web page as the stored procedure had. but its giving the above written error
how to solve it.

thanks in advance
Posted
Comments
db7uk 19-Jun-12 4:36am    
Please show some code. Please show the way you are passing the arguments. We cant work out if you are using ADO.NET or Entity framework etc. Please show you SP header including the variable layout. This will help to determine what exactly should be passed. Please improve question.
abhilasha mourya 19-Jun-12 4:42am    
I am passing the values by using this function


public void UpdHtlPrfCRS(ClsHtlPrf ObjHtlPrfPrp)
{
if (con.State == ConnectionState.Closed)
{
con.Open();
}

SqlCommand cmd = new SqlCommand("UpdHtlPrfCRS", con);
cmd.CommandType = CommandType.StoredProcedure;

//cmd.Parameters.Add("@PrfID", SqlDbType.Int).Value = ObjHtlPrfPrp.HotelProfileID;
cmd.Parameters.Add("@HtlID", SqlDbType.Int).Value = ObjHtlPrfPrp.HotelID;
cmd.Parameters.Add("@HtlNam", SqlDbType.VarChar, 150).Value = ObjHtlPrfPrp.HotelName;
cmd.Parameters.Add("@HtlPrf", SqlDbType.VarChar, 350).Value = ObjHtlPrfPrp.HotelProfile;
cmd.Parameters.Add("@Htlimg", SqlDbType.VarChar, 150).Value = ObjHtlPrfPrp.HotelImage;
cmd.Parameters.Add("@HtlLogo", SqlDbType.VarChar, 150).Value = ObjHtlPrfPrp.HotelLogo;
cmd.Parameters.Add("@HtlBanner", SqlDbType.VarChar, 150).Value = ObjHtlPrfPrp.HotelBanner;
cmd.Parameters.Add("@HtlHeader", SqlDbType.VarChar, 150).Value = ObjHtlPrfPrp.HotelHeader;//HtlHeader
cmd.Parameters.Add("@HtlEmailSender", SqlDbType.VarChar, 150).Value = null;
cmd.Parameters.Add("@HtlCcSender", SqlDbType.VarChar, 150).Value = null;
cmd.Parameters.Add("@HtlBccSender", SqlDbType.VarChar, 150).Value = null;
cmd.Parameters.Add("@HtlSmtpHost", SqlDbType.VarChar, 150).Value = null;
cmd.Parameters.Add("@HtlSmtpPort", SqlDbType.Int).Value = null;
cmd.Parameters.Add("@HtlMsgApiUrl", SqlDbType.VarChar).Value = null;
cmd.Parameters.Add("@HtlMobileSender", SqlDbType.VarChar).Value = null;
cmd.Parameters.Add("@HtlHomeUrl", SqlDbType.VarChar).Value = null;
cmd.Parameters.Add("@AboutUsUrl", SqlDbType.VarChar).Value = null;
cmd.Parameters.Add("@ContactUsUrl", SqlDbType.VarChar).Value = null;
cmd.Parameters.Add("@ReviewUrl", SqlDbType.VarChar).Value = null;
cmd.Parameters.Add("DataSelecUrl", SqlDbType.VarChar).Value = null;

cmd.ExecuteNonQuery();
cmd.Dispose();

con.Close();
}


here is the stored procedure


ALTER PROCEDURE [dbo].[UpdHtlPrfCRS]
(@HtlID int,
@HtlNam varchar(150),
@HtlPrf varchar(350),
@Htlimg varchar(150),
@HtlLogo varchar(350),
@HtlBanner varchar(150),
@HtlHeader varchar(150),
@HtlEmailSender varchar(150),
@HtlCcSender varchar(150),
@HtlBccSender varchar(150),
@HtlSmtpHost varchar(150),
@HtlSmtpPort int,
@HtlMsgApiUrl varchar(150),
@HtlMobileSender varchar(150),
@HtlHomeUrl varchar(150),
@HtlAboutusUrl varchar(150),
@HtlContactUsUrl varchar(150),
@HtlReviewUrl varchar(150),
@HtlDateSelecUrl varchar(150))
AS
BEGIN
update tbHtlPrf set HtlNam=isnull(@HtlNam,HtlNam),HtlPrf=isnull(@HtlPrf,HtlPrf), HtlImg=isnull(@Htlimg,HtlImg),HtlLogo=isnull(@HtlLogo,HtlLogo),HtlBanner=isnull(@HtlBanner,HtlBanner),HtlHeader=isnull(@HtlHeader,HtlHeader),HtlEmailSender=isnull(@HtlEmailSender,HtlEmailSender),HtlCcSender=isnull(@HtlCcSender,HtlCcSender),HtlBccSender=isnull(@HtlBccSender,HtlBccSender),
HtlSmtpHost=isnull(@HtlSmtpHost,HtlSmtpHost),HtlSmtpPort=isnull(@HtlSmtpPort,HtlSmtpPort),HtlMsgApiUrl=isnull(@HtlMsgApiUrl,HtlMsgApiUrl),HtlMobileSender=isnull(@HtlMobileSender,HtlMobileSender),HtlHomeUrl=isnull(@HtlHomeUrl,HtlHomeUrl),
HtlAboutUsUrl=isnull(@HtlAboutusUrl,HtlAboutUsUrl),HtlContactUsUrl=isnull(@HtlContactUsUrl,HtlContactUsUrl),HtlReviewUrl=isnull(@HtlReviewUrl,HtlReviewUrl),HtlDateSelecUrl=isnull(@HtlDateSelecUrl,HtlDateSelecUrl) where HtlID=@HtlID;
END

1 solution

Please make sure that paramter names are same.

SQL
@HtlAboutusUrl, @HtlContactUsUrl, @HtlReviewUrl are passed as 

cmd.Parameters.Add("@AboutUsUrl", SqlDbType.VarChar).Value = null;
cmd.Parameters.Add("@ContactUsUrl", SqlDbType.VarChar).Value = null;
cmd.Parameters.Add("@ReviewUrl", SqlDbType.VarChar).Value = null;

it should be - 

cmd.Parameters.Add("@HtlAboutusUrl", SqlDbType.VarChar).Value = null;
cmd.Parameters.Add("@HtlContactUsUrl", SqlDbType.VarChar).Value = null;
cmd.Parameters.Add("@HtlReviewUrl ", SqlDbType.VarChar).Value = null;

and last parameter is @HtlDateSelecUrl, but passed as 

cmd.Parameters.Add("DataSelecUrl", SqlDbType.VarChar).Value = null;

it should be:
cmd.Parameters.Add("@HtlDateSelecUrl", SqlDbType.VarChar).Value = null;
 
Share this answer
 
Comments
abhilasha mourya 19-Jun-12 5:09am    
thanks
don't know how i forgot these things
abhilasha mourya 19-Jun-12 5:14am    
i have corrected these values but still it is giving the same error

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