asp数据库错误

来源:百度知道 编辑:UC知道 时间:2024/07/04 10:11:03
asp编程时,往数据库中添加数据数据库并没有执行insert操作
用sql查询分析器输入添加语句,验证
sql="insert books(book_name,price,author,press,types,sums,remaincount,recomment,comment) values ('"&book_name&"',"&price&",'"&author&"','"&press&"','"&types&"',"&sums&","&remaincount&","&recomment&",'"&comment&"')"
显示:第 1 行: '=' 附近有语法错误。
不知道如何改正,请高手指点,谢谢

像这样的问题 我的解决方法是用排除
先写了 能执行的语句
例如 insert into books(book_name, …………)value ("书名称")
就是把所有的内容都写固定了
如果能执行了
你就把 相应的字段值 再改为用变量

语法有误

sql="insert into books(book_name,price,author,press,types,sums,remaincount,recomment,comment) values ("&book_name&",'"&price&"','"&author&"','"&press&"','"&types&"','"&sums&"','"&remaincount&"','"&recomment&'",'"&comment&"')"

response.write sql
response.end
把sql语句输出来,看看哪个变量出问题了.