我正在尝试使用PHP查询MSSQL EXPRESS(2008 R2)数据库并提取数据。但是,当我从数据库中拉取基于ntext的数据时,出现错误。
错误如下:
Unicode数据在仅限Unicode的排序规则或ntext数据中不能发送到使用DB-Library(例如ISQL)或ODBC版本3.7或更早版本的客户端。 (严重性16)
我的脚本如下:
$myServer = ".\SQLEXPRESS";
$myUser = "sa";
$myPass = "blablabla";
$myDB = "test";
//connection to the database
$dbhandle = mssql_connect($myServer, $myUser, $myPass)
or die("Couldn't connect to SQL Server on $myServer");
//select a database to work with
$selected = mssql_select_db($myDB, $dbhandle)
or die("Couldn't open database $myDB");
//declare the SQL statement that will query the database
$query = "SELECT * FROM dbo.table WHERE query='2'";
//$query .= "FROM dbo.table ";
//$query .= "WHERE query='2'";
//execute the SQL query and return records
$result = mssql_query($query);
$numRows = mssql_num_rows($result);
echo "<h1>" . $numRows . " Row" . ($numRows == 1 ? "" : "s") . " Returned </h1>";
//display the results
while($row = mssql_fetch_array($result))
{
echo "<li>" . $row["query"]. "</li>";
}
//close the connection
mssql_close($dbhandle);
非常感谢您的帮助...
谢谢...