过程或函数'DMLgrid_SP'需要参数'@id',这是未提供的。 [英] Procedure or function 'DMLgrid_SP' expects parameter '@id', which was not supplied.
本文介绍了过程或函数'DMLgrid_SP'需要参数'@id',这是未提供的。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好,我是初学者,我只是尝试在gridview中使用基本的DML概念,但我得到了错误,但我不知道如何清除这个请帮助我....
我的.cs代码在这里....
public void gedata()
{
connection();
HiddenField1.Value = view;
query = DMLgrid_SP;
com = new SqlCommand(query,con);
com.CommandType = CommandType.StoredProcedure;
com.Parameters.AddWithValue( @ Action,HiddenField1.Value).ToString( );
SqlDataAdapter da = new SqlDataAdapter(com);
DataSet ds = new DataSet();
da.Fill(ds);
GridView1.DataSource = ds;
GridView1.DataBind();
con.Close();
}
请告诉我什么时候我想添加参数id
解决方案
错误信息非常清楚。
这意味着StoredProcedure
DMLgrid_SP
期待参数@id
,但你不是从代码发送的。
所以,做下面这样的事情来发送参数。
com.Parameters.AddWithValue( @ id,someID);
也不需要在这里调用ToString()
。
com.Parameters.AddWithValue(@ Action,HiddenField1.Value).ToString()< /击>;
hello, i'm beginner for here, i just try to basic DML concept in gridview but i got error but i dont know how to clear this please help me....
My .cs code here....
public void gedata()
{
connection();
HiddenField1.Value = "view";
query = "DMLgrid_SP";
com = new SqlCommand(query, con);
com.CommandType = CommandType.StoredProcedure;
com.Parameters.AddWithValue("@Action", HiddenField1.Value).ToString();
SqlDataAdapter da = new SqlDataAdapter(com);
DataSet ds = new DataSet();
da.Fill(ds);
GridView1.DataSource = ds;
GridView1.DataBind();
con.Close();
}
please tell me when i want to add parameter id
解决方案
The error message is quite clear.
That means theStoredProcedure
"DMLgrid_SP
" is expecting parameter@id
, but you are not sending that from code.
So, do something like below to send the parameter.
com.Parameters.AddWithValue("@id", someID);
Also no need callToString()
here.
com.Parameters.AddWithValue("@Action", HiddenField1.Value).ToString();
这篇关于过程或函数'DMLgrid_SP'需要参数'@id',这是未提供的。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文