逐梦论坛's Archiver

shillan 发表于 2006-11-19 21:06

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]

Powered by Discuz! Archiver 7.2  © 2001-2009 Comsenz Inc.