this is the error:
Error Type:
Microsoft JET Database Engine (0x80040E14)
Syntax error in INSERT INTO statement.
/proj/save.asp, line 26

====

this is my insert into statement:

Dim cat, desc, author, strSQL
cat = request.form("category")
desc = request.form("description")
author = request.form("by")

strSQL = "INSERT INTO " & cat & " (description,ddate,by) VALUES ("
strSQL = strSQL & "'" & trim(desc) & "', "
strSQL = strSQL & "'" & trim(date()) & "', "
strSQL = strSQL & "'" & trim(author) & "') "
mySQLConn.Execute strSQL

Syntax is:
INSERT INTO "tablename" VALUES('.......

Assuming 'cat' is a tablename:

Dim cat, desc, author, strSQL
cat = request.form("category")
desc = request.form("description")
author = request.form("by")

strSQL = "INSERT INTO " & cat & " VALUES ('" & trim(desc) & "', '" & trim(date()) & "', '" & trim(author) & "')"
mySQLConn.Execute strSQL

Syntax error in INSERT INTO statement.
This commonly occurs when your field name is a reserved word. Adjust your field names and SQL statement accordingly and you should avoid the problem.

If you can't adjust your fieldnames you can use [ ] marks to delimit the field names, eg

INSERT INTO table1
([field], [password])
VALUES ('value1', 'value2')

See you have the field name 'by' you should use it like [by]


Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.