过程或函数'adminquestion'需要参数'@ option1',这是未提供的。 [英] Procedure or function 'adminquestion' expects parameter '@option1', which was not supplied.
本文介绍了过程或函数'adminquestion'需要参数'@ option1',这是未提供的。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我不知道我错了可以帮助我吗?
使用的代码:
I don't get it where i am wrong can anyone help me??
code used :
protected void Button1_Click(object sender, EventArgs e)
{
string connection = ConfigurationManager.AppSettings["connection"];
SqlConnection con = new SqlConnection(connection);
con.Open();
SqlCommand cmd = new SqlCommand("adminquestion", con);
cmd.Parameters.AddWithValue("@ques", TextBox1.Text);
cmd.Parameters.AddWithValue("@options1", TextBox2.Text);
cmd.Parameters.AddWithValue("@options2", TextBox3.Text);
cmd.Parameters.AddWithValue("@options3", TextBox4.Text);
cmd.Parameters.AddWithValue("@options4", TextBox5.Text);
cmd.CommandType = CommandType.StoredProcedure;
cmd.ExecuteNonQuery();
con.Close();
}
因为我想要这四个选项在一栏中
我尝试过:
as i want these four option in one column
What I have tried:
alter procedure adminquestion
@ques varchar(225),
@option1 varchar(225),
@option2 varchar(225),
@option3 varchar(225),
@option4 varchar(225)
AS
BEGIN
INSERT INTO [dbo].[t_questions] (qtext) VALUES(@ques)
INSERT INTO [dbo].[answer](aoption) select '@option1' union select '@option2' union select '@option3' union select '@option4'
END
推荐答案
@option1 varchar(225),
cmd.Parameters.AddWithValue("@options1", TextBox2.Text);
看到问题?
编辑:你的SP无论如何都无法工作
See the problem?
Your SP isn't going to work anyway
拼写检查
spell check
cmd.Parameters.AddWithValue("@option1", TextBox2.Text);
cmd.Parameters.AddWithValue("@option2", TextBox3.Text);
cmd.Parameters.AddWithValue("@option3", TextBox4.Text);
cmd.Parameters.AddWithValue("@option4", TextBox5.Text);
这篇关于过程或函数'adminquestion'需要参数'@ option1',这是未提供的。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文