title: using sqlmapper.query in dapper with parameters
body: <p>I am creating a web app using web api mvc and I am using dapper.</p>
  
  <p>Here is a scenario where I want to get the data in a list by validating user info</p>
  
  <pre><code>DynamicParameters param = new DynamicParameters();
  param.Add("@fname", std.Fname);
  param.Add("@lname", std.Lname);
  param.Add("@action", "L");
  IList&lt;student&gt; studlist = SqlMapper.Query&lt;student&gt;(con, "Stud_IUDV", param).ToList();
  return studlist.ToList();
  </code></pre>
  
  <p>Here I want to get the data by validating these params and my storedprocedure looks like</p>
  
  <pre><code>if(@action='L')
  //validation with select command
  
  else
  //select all data
  </code></pre>
  
  <p>and I am suppose to get </p>
  
  <pre><code>(validation with select command)
  </code></pre>
  
  <p>but else part of my storedprocedure is executing</p>
  
  <p>What is wrong in my code?</p>