Board logo

标题: [软件故障] Microsoft VBScript 编译器错误 错误 '800a0401' 语句未结束 的解决方法 [打印本页]

作者: shillan    时间: 2006-11-19 21:06     标题: Microsoft VBScript 编译器错误 错误 '800a0401' 语句未结束 的解决方法

现象:asp执行如下sql语句
sql="insert into gzfx(title,sort_id,autor,happentime,reason,analyseperson,introduce,reasonanalyse,method,fillperson,filltime,pic) values('"&title&"',"&sort_id&",'"&autor&"','"&happentime&"','"&reason&"','"&analyseperson&"','"&intro&"','"&reasonanalyse&"','"&method&"','"&fillperson&"','"&filltime&"','"&pic&"')"
时出现错误提示:
microsoft vbscript 编译器错误 错误 '800a0401'

语句未结束

/admin/gzfx_save.asp,行 16

sql="insert into gzfx(title,sort_id,autor,happentime,reason,analyseperson,introduce,reasonanalyse,method,fillperson,filltime,pic) values('"&title&"',"&sort_id&",'"&autor&"','"&happentime&"','"&reason&"','"&analyseperson&"','"&intro&"','"&reasonanalyse&"','"&method&"','"&fillperson&"','"&filltime&"','"&pic&"')"
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------^


原因:此sql语句本身并没错,是因为&与某些字符结合时会组成16进制数,导致出错。

解决:把&的两侧都加上空格即可解决。
如以上语句变为:
sql="insert into gzfx(title,sort_id,autor,happentime,reason,analyseperson,introduce,reasonanalyse,method,fillperson,filltime,pic) values('" & title & "'," & sort_id & ",'" & autor & "','" & happentime & "','" & reason & "','" & analyseperson & "','" & intro & "','" & reasonanalyse & "','" & method & "','" & fillperson & "','" & filltime & "','" & pic & "')"




欢迎光临 逐梦论坛 (http://temp2023.zhumeng.org/) Powered by Discuz! 7.2