asp插入语句

来源:百度知道 编辑:UC知道 时间:2024/09/25 22:20:41
请帮我看看我的错在哪里,
代码
if uname<>empty and sex<>empty and high<>empty and tel<>empty and xiangmu<>empty and mudi<>empty then
exec="insert into message(uname,sex,birth,high,a1,tel,address,a2,xiangmu,mudi,a3,qq,eamil,shuoming) values('"&uname&"','"&sex&"',‘"&birth&"’,"&high&",'"&a1&"',"&tel&",'"&address&"',"&a2&",'"&xiangmu&"','"&mudi&"','"&a3&"','"&qq&"','"&email&"','"&shuoming&"')"
conn.execute exec
conn.close
set conn=nothing

错误提示,
错误类型:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC Microsoft Access Driver] INSERT INTO 语句的语法错误。
/love/zaixianbaoming1.asp, 第 111 行

SQL语句错了
你response.write exec,在MSSQL中看看是否能运行出来,可能是你的参数里存在“'”或“,”,使得SQL语句语法错误

你说的111行是这里的哪一句?

exec="insert into message(uname,sex,birth,high,a1,tel,address,a2,xiangmu,mudi,a3,qq,eamil,shuoming) values('"&uname&"','"&sex&"',‘"&birth&"’,"&high&",'"&a1&"',"&tel&",'"&address&"',"&a2&",'"&xiangmu&"','"&mudi&"','"&a3&"','"&qq&"','"&email&"','"&shuoming&"')" '楼主是否看清这裏‘"&birth&"’你用的是单引号哟

if uname<>empty and sex<>empty and high<>empty and tel<>empty and xiangmu<>empty and mudi<>empty then '楼主这裏的and用or