• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Database Error Number 7405

Hello All

I'm running into some issues with querying my MSSQL Database. I have a DB that is pulling a list of employees from Active Directory into a View. Everything works fine with the view and I have used it in the past but not with CI.

I now have a CI Model that is supposed to search the table using the WHERE LIKE statement.

My Model looks like this:

class NHCEmployee_model extends Model{
    var $NHCUsers;

    function NHCEmployee_model(){
        $this->NHCUsers = $this->load->database('NHCUsers', TRUE);
    function search_employees($displayname){
        $this->NHCUsers->select('displayname, username');
        $this->NHCUsers->like('displayname', $displayname);
        $query = $this->NHCUsers->get('tblNHCEmployees');
        return $query->result();

I have the the Database all set up perfectly in CI with the correct User/Pass. But whenever I run the query I get this error message:

<h1>A Database Error Occurred</h1>
        <p>Error Number: 7405</p><p></p><p>SELECT displayname, username
FROM tblNHCEmployees
WHERE  displayname  LIKE '%ste%'</p>

Is there any way to debug these Error Numbers? When I run this query in MSSQL Management Query it performs fine.

Thank you for the help!


This is just a suggestion, but maybe give the select function an array as opposed to a string? I'm not sure if it even accepts an array but it may be worth a shot!

# Change:
$this->NHCUsers->select('displayname, username');

# To:

Hope you fix it.


Hi Ben,
Thanks for the tip. I tried it with an array and received the same results. I have used both strings and arrays in my select statements in the past and they have both worked out just fine.

But I'm guessing there is something else that is happening.

Thanks for the help anyways!

From: http://ellislab.com/codeigniter/user-gui...lpers.html
Try using this function: $this->db->last_query();, copy the result and paste it to PhpMyAdmin()

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.