title: How To Fix 'No mapping exists from object type System.Data.SqlClient.SqlParameter to a known managed provider native type.' error in ASP.Net
body: <p>I am trying to call stored procedure from a controller. It's values come from ajax to controller. How can I resolve this error I'm getting?</p>
  
  <p>Here is my stored procedure</p>
  
  <pre><code>ALTER PROCEDURE [dbo].[sp_Get_OADetails_By_Customer]
      @CustCode NVARCHAR(15),
      @Status INT,
      @Sdate NVARCHAR(20),
      @Edate NVARCHAR(20)
  AS
  BEGIN
      SELECT   
          O.OANO, O.OADate, O.PONO, O.PODATE,
          SO.POLI, SO.ID, SO.MOULDCODE, SO.DESCRIPTION,
          SO.Drg, SO.Rev, M.METALNAME,
          SO.QTY, U.UNITName, SO.DELIVERYDT 
      FROM
          OADetails AS O 
      LEFT OUTER JOIN 
          CustomerDetails AS C ON O.PCODE = C.PCODE 
      LEFT OUTER JOIN 
          SubOADetail AS SO ON O.OANO = SO.OANO 
      LEFT OUTER JOIN 
          MetalDetails AS M ON SO.METALCODE = M.METALCODE 
      LEFT OUTER JOIN 
          UNITMaster AS U ON SO.UNIT = U.UNITID 
      WHERE
          C.CUSTCODE = @CustCode 
          AND O.Status = @Status 
          AND o.OADATE BETWEEN @Sdate AND @Edate
  END
  </code></pre>
  
  <p>Here is my controller </p>
  
  <pre><code>[HttpPost]
  public ActionResult GetOADetailByCustomer(string custcode, int status, string yr)
  {
          var CST = new SqlParameter
          {
              ParameterName = "CUSTCODE",
              Value = custcode
          };
  
          var ST = new SqlParameter
          {
              ParameterName = "Status",
              Value = status
          };
  
          var yearval = Db.Years.Where(x =&gt; x.YEAR1 == yr).FirstOrDefault();
  
          var courseList = Db.Database.SqlQuery&lt;OADetail&gt;("exec sp_OADetails_Get @CustCode, @Status, @Sdate, @Edate",
              new SqlParameter("@CustCode", CST),
              new SqlParameter("@Status", ST),
              new SqlParameter("@Sdate", yearval.SDATE),
              new SqlParameter("@Edate", yearval.EDATE)).FirstOrDefault&lt;OADetail&gt;();
          return View();
  }
  </code></pre>
  
  <p>Can anyone help me?</p>
  
  <p>Thank you in advance..</p>