【发布时间】:2011-03-24 04:46:43
【问题描述】:
我正在尝试使用 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);
对此的任何帮助表示赞赏....
谢谢....
【问题讨论】:
标签: php