gpt4 book ai didi

ms-access - 语法错误,我没有看到 :S

转载 作者:行者123 更新时间:2023-12-04 23:57:00 25 4
gpt4 key购买 nike

显然我遇到了语法错误,但我的代码没有发现任何问题!

if rs.EOF then
'User doesn't exist, create the record
query = currentDate&",'"
query = query + password & "','"
query = query + "user', '"
query = query + email & "', '"
query = query + fname & "', '"
query = query + sname & "'"

handle = add_to_database("users","jdate,password,perms,email,fname,sname",query)
response.write handle
else
response.write "Error: User already exists, please use a different email address"
end if

这是 add_to_database 函数
function add_to_database(where,column,values)       
'Create query
sql = "INSERT INTO " & where & " (" & column & ") VALUES (" & values & ")"
on error resume next
'Add images to database
conn.Execute sql,recaffected

if err<>0 then
add_to_database = err.description &":"&sql&"<br />"
end if

'Destroy connection
sql = ""
end function

这是写入页面的错误
Syntax error in INSERT INTO statement.:INSERT INTO users (jdate,password,perms,email,fname,sname) VALUES (#2013/8/2#,'af453d19feb2520c8c0d30fb39ebd211','user', 'martynleeba@gmail.com', 'Martyn', 'Ball')

最佳答案

users表包含一个名为 password 的字段.但是passwordreserved word ,因此在查询中找到它时可能会混淆数据库引擎。如果可能,重命名该字段。如果您必须保持名称不变,请将其括在方括号中,以向 db 引擎表明它是一个对象名称。

handle = add_to_database("users","jdate,[password],perms,email,fname,sname",query)

关于ms-access - 语法错误,我没有看到 :S,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18006272/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com