Microsoft VBScript 编译器错误 错误 '800a0401' 语句未结束 的解决方法
[color=blue]现象:[/color]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&"')"
时出现错误提示:
[color=red]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&"')"
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------^[/color]
[color=green]原因:[/color]此sql语句本身并没错,是因为&与某些字符结合时会组成16进制数,导致出错。
[color=red]解决:[/color]把&的两侧都加上空格即可解决。
如以上语句变为:
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 & "')"
页:
[1]