title: Get Data From Stored Procedure Using Sqlsrv Driver
body: <p>I am using <code>SQL server2008</code> as database and I have written stored procedure in <code>MSSQL Server 2008</code>. It's working fine in <code>MSSQL Server 2008</code>. I want to call this Stored Procedure from <code>codeigniter</code>. For that I wrote the code like this : </p>
  
  <p><strong>phpService.php:</strong></p>
  
  <pre><code>public function Login($username, $password)
  {
      $this-&gt;load-&gt;model('Apimodel');
      $result = $this-&gt;Apimodel-&gt;Login($username,$password);
  
      header('Content-type: application/json');
      echo json_encode(array('LoginResponce'=&gt;$result));
  }
  </code></pre>
  
  <p><strong>apimodel.php:</strong></p>
  
  <pre><code>function Login($UserName,$Password)
  {               
      $this-&gt;db = $this-&gt;GetDB();
      $query =  $this-&gt;db-&gt;query("EXEC Login");
  
      return $query-&gt;result();
  
  }
  </code></pre>
  
  <p><strong>when I Execute Procedure without parameter it Working Fine</strong> </p>
  
  <pre><code>function Login($UserName,$Password)
      {               
          $this-&gt;db = $this-&gt;GetDB();
          $query =  $this-&gt;db-&gt;query("EXEC Login '$UserName','$Password'");
  
          return $query-&gt;result();
  
      }
  </code></pre>
  
  <p><strong>But, When I Execute Procedure with parameter it's not working</strong> </p>
  
  <p>Can anyone tell me What am I missing here ?</p>
  
  <p>Thanks in advance </p>