云南網(wǎng)站建設(shè)創(chuàng)新企業(yè) 昆明多彩網(wǎng)絡(luò)公司

在線qq:540105663

php讀取mssql出現(xiàn)不能用 DB-Library(如 ISQL)或 ODBC 3.7

來源:昆明多彩網(wǎng)絡(luò)公司 日期:2010-12-31 閱讀: 發(fā)表評論

用php去讀mssql出現(xiàn)不能用 DB-Library(如 ISQL)或 ODBC 3.7類似的錯誤,這是因為mssql的text編碼和php編碼不一致造成的。

在用php腳本讀取mssql的時候發(fā)現(xiàn)無法讀取數(shù)據(jù),發(fā)生錯誤。

完整的錯誤提示為:Warning: mssql_query() [function.mssql-query]: message: Unicode data in a Unicode-only collation or ntext data cannot be sent to clients using DB-Library (such as ISQL) or ODBC version 3.7 or earlier.

中文提示:Warning: mssql_query() [function.mssql-query]: message: 不能用 DB-Library(如 ISQL)或 ODBC 3.7 或更早版本將 ntext 數(shù)據(jù)或僅使用 Unicode 排序規(guī)則的 Unicode 數(shù)據(jù)發(fā)送到客戶端。

錯誤原因:mssql的text字段的編碼和php的內(nèi)置編碼不一致導(dǎo)致的。

解決方法:$sql = "select CAST(test1 AS TEXT) AS test1 from tablename";

問題解決。

發(fā)表評論評論列表(有 條評論)