返回列表 发帖

[软件故障] 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 & "')"
欢迎光临:逐梦论坛

返回列表

Powered by Discuz! 7.2   论坛QQ群:逐梦论坛群

© 2001-2021 Comsenz Inc. 鲁公网安备 37120302000001号