Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/327.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sql-server/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql Server 2008缺少参数错误c#代码隐藏_C#_Sql Server_Sql Server 2008 - Fatal编程技术网

Sql Server 2008缺少参数错误c#代码隐藏

Sql Server 2008缺少参数错误c#代码隐藏,c#,sql-server,sql-server-2008,C#,Sql Server,Sql Server 2008,Sql Server 2008表示缺少@event\u id参数,但我已确认它有一个值 我已经用相同的事件id测试了usp\u get\u it\u alert\u成员的存储过程,它返回了正确的值 有人能推荐一些额外的故障排除步骤吗 try { Int32 event_id = Convert.ToInt32(Session["event_id"].ToString()); using (SqlConnection cnn = new SqlConnection(GetConnec

Sql Server 2008表示缺少
@event\u id
参数,但我已确认它有一个值

我已经用相同的
事件id
测试了
usp\u get\u it\u alert\u成员的
存储过程,它返回了正确的值

有人能推荐一些额外的故障排除步骤吗

try
{
   Int32 event_id = Convert.ToInt32(Session["event_id"].ToString());

   using (SqlConnection cnn = new SqlConnection(GetConnectionString())){
       cnn.Open();

       using (SqlCommand cmd = new SqlCommand("usp_get_it_alert_members", cnn)){
          cmd.Parameters.AddWithValue("@event_id", event_id);

        using (SqlDataReader rdr = cmd.ExecuteReader()){
           while (rdr.Read()){
               ...
           } 
您尚未指定存储过程

cmd.CommandType = CommandType.StoredProcedure;
您尚未指定存储过程

cmd.CommandType = CommandType.StoredProcedure;

谢谢,我以为我疯了。谢谢,我以为我疯了。