php讀取sql2000上unicode欄位出現錯誤

回覆文章
布魯斯
Site Admin
文章: 211
註冊時間: 週四 2月 16, 2006 3:34 pm

php讀取sql2000上unicode欄位出現錯誤

文章 布魯斯 »

in relation to the "unicode problem" mentioned by andrej at dairyweb dot com dot au I suggest use andrew at power-grid dot com's solution:

if you get a "Unicode data in Unicode-only collation or ntext data cannot be sent to clients using DB-Library (such as ISQL) or ODBC version 3.7 or earlier" error you can use this kind of code (in an MS environment, of course):
<?
$db = new COM("ADODB.Connection");
$dsn = "DRIVER={SQL Server}; SERVER={SERVER};UID={USER};PWD={PASS}; DATABASE={DB}";
$db->Open($dsn);
$rs = $db->Execute("SELECT * FROM table");

while (!$rs->EOF)
{
echo $rs->Fields['column']->Value."<BR>";
$rs->MoveNext();
}
?>
回覆文章