title: ExecuteScalar compilation error
body: <p>I'm getting an error on <code>ExecuteScalar()</code>. It says I must declare the scalar variable <code>@PicID</code>. How could I declare a scalar varaible? Or am I doing this entire function incorrectly?</p>
  
  <pre><code> public int GetTotalNoVotes(int PicRating, int PicID)
      {
          //get database connection string from config file 
          string strConectionString = ConfigurationManager.AppSettings["DataBaseConnection"];
  
          SqlConnection conn = new SqlConnection(strConectionString);
          conn.Open();
  
          SqlCommand oCommand = new SqlCommand("SELECT COUNT(1) AS Expr1 FROM Ratings WHERE PicRating = @PicRating) AND (PicID = @PicID)", conn);
          oCommand.Parameters.Add("@PictureID", SqlDbType.Int);
          oCommand.Parameters["@PictureID"].Value = PicID;
  
          oCommand.Parameters.Add("@PicRating", SqlDbType.Int);
          oCommand.Parameters["@PicRating"].Value = PicRating;
  
          object oValue = oCommand.ExecuteScalar();
  
          conn.Close();
  
          if (oValue == DBNull.Value)
          {
              return 0;
          }
          else
          {
              return Convert.ToInt32(oValue);
          }
      }
  </code></pre>