title: How can Pass string as parameter in Web Api C#
body: <p>How can I pass string parameter in Web API    </p>
  
  <blockquote>
    <p>{"Message":"No HTTP resource was found that matches the request URI
    '<a href="http://localhost:60698/api/values/GetBynamed/sudeesh3" rel="nofollow noreferrer">http://localhost:60698/api/values/GetBynamed/sudeesh3</a>'.","MessageDetail":"No
    action was found on the controller 'Values' that matches the
    request."}</p>
  </blockquote>
  
  <pre><code>public IHttpActionResult getbynamed(string name)
      {
                  List&lt;ImgModel&gt; list1 = new List&lt;ImgModel&gt;();
                  ImgModel mod = new ImgModel();
                  SqlConnection con = new SqlConnection(cs);
                  if (con.State == ConnectionState.Closed) con.Open();
                  SqlCommand cmd = new SqlCommand("select * from tbl_details where name='" + name + "'", con);
                  SqlDataReader dr = cmd.ExecuteReader();
                  if (dr.HasRows)
                  { 
                      while (dr.Read())
                      {
  
                          mod.id = Convert.ToInt32(dr[0].ToString());
                          mod.img = dr[1].ToString();
                          mod.name = dr[2].ToString();
                          mod.phone = dr[3].ToString();
                          list1.Add(mod);
                      }
                      return Ok(list1);
                  }
                  else
                  {
                      return NotFound();
                  }
  
              }
  </code></pre>