过程或函数"GroupSelect_All"需要未提供的参数"@id". [英] Procedure or Function 'GroupSelect_All' expects parameter '@id', which was not supplied.

查看:86
本文介绍了过程或函数"GroupSelect_All"需要未提供的参数"@id".的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Globali GB17=new Globali();

public DataSet Selectall(int id)
{
    //Create and open new sql connection
    SqlConnection Gconn = new SqlConnection(GB17.autocreateconn());
    Gconn.Open();
    string Gstname = "GroupSelect_All";
    SqlCommand Gcomand1 = new SqlCommand(Gstname, Gconn);
    Gcomand1.CommandType = CommandType.StoredProcedure;
    Gcomand1.Parameters.Add("@id", SqlDbType.Int).Value = id;
    SqlDataAdapter Gda = new SqlDataAdapter(Gstname, Gconn);
    DataSet Gds = new DataSet();
            
    Gda.Fill(Gds, "lms_group");
            
    return Gds;
    //connection closed
    Gconn.Close();
  }



一切都是正确的,我不明白为什么会出现异常
唯一的例外是
过程或函数"GroupSelect_All"需要参数"@id",但未提供."

存储过程正确执行,并且在调试值期间还传递了参数
但出现异常



all things are correct wat i dont understand why exception comes
the exception is
"Procedure or Function ''GroupSelect_All'' expects parameter ''@id'', which was not supplied."

stored procedure is executed correctly and during debugging value also passed of parameter
but exception arises

推荐答案

SqlDataAdapter Gda = new SqlDataAdapter(Gstname, Gconn);

更改为

SqlDataAdapter Gda = new SqlDataAdapter(Gcomand1);

应该可以解决问题.


这篇关于过程或函数"GroupSelect_All"需要未提供的参数"@id".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆