错误执行查询的SQL Server的本机客户端10.0 [英] Error executing Queries in SQL Server Native Client 10.0

查看:183
本文介绍了错误执行查询的SQL Server的本机客户端10.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近又开始使用PHP(最后一次是像7年前)和一些恶魔推荐我使用codeigniter框架。

I'm recently began to use php again (last time was like 7 years ago) and some fiends recommended me to use codeigniter Framework.

我试图连接到数据库服务器的MSSQL 2008 R2使用ODBC驱动程序,使用64位版本的PHP在IIS x64的。这是原因之一,因为我没有使用微软提供的PHP本地驱动程序,另一种是因为生产环境将在CentOS的,并且顺便说一句没有任何意义,使用该驱动程序....

i trying to connect to database server in MSSQL 2008 R2 using a the odbc driver, using x64 php version over x64 IIS. This is one of the reasons because i'm not using the php native driver provided by microsoft, the other one is because the production enviroment will be in CentOS, and btw doesn't have any sense to use that driver ....

要去点:尝试连接到数据库使用活动记录/ ODBC配置抛出我这个错误

going to the point: Trying to connect to a database using active record / odbc configuration throws me this error

A Database Error Occurred
--------------------------
Error Number: 01000
[Microsoft][SQL Server Native Client 10.0][SQL Server]Executing SQL directly; no cursor.
SELECT * FROM (WebUsers)
Filename: C:\projects\php\test\system\database\DB_driver.php
Line Number: 330

和我只是执行一个简单的查询,检索表。

and i'm only execute a simple query to retrieve a table.

$query = $this->db->get('WebUsers');
return $query->result_array();

这是我的连接设置:

these are my connection settings:

$db['default']['hostname'] = 'Driver={SQL Server Native Client 10.0};Server=localhost;Database=XXXXXXXXX;';
$db['default']['username'] = 'WWWWWW';
$db['default']['password'] = 'YYYYYY';
$db['default']['database'] = 'XXXXXXXXX';
$db['default']['dbdriver'] = 'odbc';
$db['default']['dbprefix'] = '';
$db['default']['pconnect'] = FALSE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = '';
$db['default']['char_set'] = 'utf8';
$db['default']['dbcollat'] = 'utf8_general_ci';
$db['default']['swap_pre'] = '';
$db['default']['autoinit'] = TRUE;
$db['default']['stricton'] = FALSE;

不要有任何想法如何解决呢

DOn't have any idea how to solve it

推荐答案

我觉得这是一个古老的错误,在CI。你必须修改函数的 _form_tables() /system/database/drivers/odbc/odbc_driver.php

I think this is an old bug in CI. You have to modify a function _form_tables() in /system/database/drivers/odbc/odbc_driver.php

function _from_tables($tables)
{
    if ( ! is_array($tables))
    {
        return strstr($tables, ',') ? '('.$tables.')' : $tables;
    }
    else
    {
        return count($tables) > 1 ? '('.implode(', ', $tables).')' : end($tables);
    }
}

希望这会工作。

Hope this will work.

这篇关于错误执行查询的SQL Server的本机客户端10.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆