过程或函数str_feedback指定了太多参数。 [英] Procedure or function str_feedback has too many arguments specified.
问题描述
你好朋友,
我用过,继续...
如何获得...恢复此错误...
过程或函数str_feedback指定的参数太多。
Hello friends,
I have used, a proceedure...
how to get...recover this error...
""Procedure or function str_feedback has too many arguments specified."""
protected void btn_submit_Click(object sender, EventArgs e)
{
try
{
cnn.ConnectionString = ConfigurationManager.ConnectionStrings["jin"].ConnectionString;
SqlCommand cm = new SqlCommand("str_feedback", cnn);
cm.CommandType = CommandType.StoredProcedure;
cm.Parameters.Add("@food_quality", rbt_foodqual.SelectedItem.ToString());
cm.Parameters.Add("@rate_deliv", rbt_ratedeliv.SelectedItem.ToString());
cm.Parameters.Add("@rate_money", rbt_ratemoney.SelectedItem.ToString());
cm.Parameters.Add("@rate_service", rbt_rateservice.SelectedItem.ToString());
cm.Parameters.Add("@recom_friend", rbt_recomfriend.SelectedItem.ToString());
cm.Parameters.Add("@about_us", ddl_hearaboutus.SelectedItem.ToString());
cm.Parameters.Add("@others", txt_others.Text);
cnn.Open();
cm.ExecuteNonQuery();
cnn.Close();
lbl_msg.Text = "Your Feedback is Submitted Successfully";
}
catch (Exception ex)
{
//lbl_msg.Text = "There is some problem";
lbl_msg.Text = ex.Message;
}
现在这个程序:
Now this the Proceedure:
USE [JIN]
GO
/****** Object: StoredProcedure [dbo].[str_feedback] Script Date: 03/02/2013 15:19:15 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[str_feedback]
@food_quality nvarchar(50),
@rate_service nvarchar(50),
@rate_deliv nvarchar(50),
@recom_friend nvarchar(50),
@rate_money nvarchar(50),
@about_us nvarchar(50)
AS
BEGIN
declare @others nvarchar(100)
declare @time datetime
select @time=CONVERT(TIME,GETDATE())
declare @entrydate datetime
select @entrydate= GETDATE()+@time
insert into feedback(food_quality,rate_service,rate_deliv,recom_friend,rate_money,about_us,others,entrydate)values(@food_quality,@rate_service,@rate_deliv,@recom_friend,@rate_money,@about_us,@others,@entrydate)
END
[edit]已添加代码块 - OriginalGriff [/ edit]
[edit]Code block added - OriginalGriff[/edit]
推荐答案
无需查看SQL代码str_feedback过程,我们不能确切 - 但检查参数列表。该错误表示当程序期望六个或更少时,您提供七个参数。
Without seeing the SQL code for the str_feedback procedure, we can''t be exact - but check the parameter list. The error indicates that you are supplying seven parameters when the procedure expects six or fewer.
您好
将存储过程中的参数与参数进行比较从C#传来。确保两者都匹配。
假设您在存储过程中有5个参数,在这种情况下,您应该只从C#传递5个参数。
希望这能帮到你!
Hi
Compare the parameters in stored procedure with the parameters passing from C#. Make sure that both should match.
Let''s say you have 5 parameters in an stored procedure in that case you are supposed to pass only 5 parameters from C#.
Hope this will help you out!
USE [JIN]
GO
/ ******对象:StoredProcedure [dbo]。[str_feedback]脚本日期:03/02/2013 15:19:15 ****** /
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo]。[str_feedback]
@food_quality nvarchar(50),
@ rate_service nvarchar(50),
@rate_deliv nvarchar(50),
@recom_friend nvarchar(50),
@rate_money nvarchar(50) ,
@others nvarchar(100),< ------------改变了这个-----
@about_us nvarchar(50 )
AS
BEGIN
声明@time datetime
select @ time = CONVERT(TIME,GETDATE() )
声明e @entrydate datetime
select @ entrydate = GETDATE()+ @ time
插入反馈(food_quality,rate_service,rate_deliv,recom_friend,rate_money,
about_us,others,entrydate)值(@ food_quality,@ rate_service,@ rate_deliv,@ recom_friend,
@ rate_money,@ about_us,@ others,@ entrydate)
结束
参数@others应该在程序中声明!!
USE [JIN]
GO
/****** Object: StoredProcedure [dbo].[str_feedback] Script Date: 03/02/2013 15:19:15 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[str_feedback]
@food_quality nvarchar(50),
@rate_service nvarchar(50),
@rate_deliv nvarchar(50),
@recom_friend nvarchar(50),
@rate_money nvarchar(50),
@others nvarchar(100),<------------Changed this-----
@about_us nvarchar(50)
AS
BEGIN
declare @time datetime
select @time=CONVERT(TIME,GETDATE())
declare @entrydate datetime
select @entrydate= GETDATE()+@time
insert into feedback(food_quality,rate_service,rate_deliv,recom_friend,rate_money,
about_us,others,entrydate)values(@food_quality,@rate_service,@rate_deliv,@recom_friend,
@rate_money,@about_us,@others,@entrydate)
END
The parameter @others should be, declared inside the, procedure!!
这篇关于过程或函数str_feedback指定了太多参数。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!