CodeIgniter ODBC问题

Well, I had built an application intended for MSSQL, and originally ran it that way, I bought a new computer and for some odd reason it won't let me connect via MSSQL.

So I set up ODBC. It connects fine, but it seems to hate active records. Am I going to have to rewrite all my queries? or is there something I'm missing. I get errors like this.

A Database Error Occurred
Error Number: 37000
[Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near ')'.
SELECT * FROM (News) ORDER BY id desc`

The easy way out is to open the file system/database/drivers/odbc/odbc_driver.php under your CodeIgniter folder. Look for the function named _from_tables (in my case this is line 482).

Change the return statement from:

return '('.implode(', ', $tables).')';

To:

return implode(', ', $tables);

This should do it!

You could remove ( and ) around the table name. It does not work in SQL Server 2008, too!

You can change odbc_driver.php file at this location system\database\drivers\odbc and change

return '('.implode(', ', $tables).')' to return implode(', ', $tables); 

in _from_tables() function. This will not add ( and ) in table names and will work perfectly.