在多字节的目标代码页中,没有此 Unicode 字符可以映射到的字符。

carlxuke444 2009-09-24 04:56:25
在多字节的目标代码页中,没有此 Unicode 字符可以映射到的字符。
同样的一个php file,连接到同样的一个远程数据库
$db = new COM("ADODB.Connection",NULL,CP_UTF8);
$dsn = "DRIVER={SQL Server};SERVER=;UID=;PWD=; DATABASE=;autotranslate=no";
$result = new COM("ADODB.RecordSet");
$result->CursorLocation =3;
$a=$_POST["fda"];
$sql="insert into test(test) values(N'$a')";
$result->open($sql,$db);
在我机器上运行的时候提示
Could not convert string to unicode: `在多字节的目标代码页中,没有此 Unicode 字符可以映射到的字符。 '
Fatal error: Uncaught exception 'com_exception' with message '<b>Source:</b> Microsoft OLE DB Provider for ODBC Drivers<br/><b>Description:</b> [Microsoft][ODBC SQL Server Driver][SQL Server]Unclosed quotation mark before the character string '闃?'.' in F:\Localhost\mmm4him\b.php:31 Stack trace: #0 F:\Localhost\mmm4him\b.php(31): com->open('insert into tes...', Object(com)) #1 {main} thrown in

但是php文件上传到服务器就一切正常.php.ini也都是完全一样的,是不是有什么问题在IIS上?
windows7+ php5 fast cgi
数据库都是同一个远程服务器上的mssql

...全文
1611 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
yctin 2009-09-26
  • 打赏
  • 举报
回复
多留意错误信息
Unclosed quotation mark before the character string '阒?'.'
fxs_2008 2009-09-24
  • 打赏
  • 举报
回复
楼上正解
只有数字类型可以不用引号

可你前有N,
foolbirdflyfirst 2009-09-24
  • 打赏
  • 举报
回复
sql语句错了。

$sql="insert into test(test) values('N$a')";

21,891

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧