Anonymous
2009-11-30 14:09:23 UTC
INSERT INTO Account (Fname,Lname,Address,
Username,Password,Email,Activated) VALUES
("fred","flintstone","bedrock rd","fredflinstone","fredflintstone",
"fredflintstone@nowhere.com","yes")
Source code that generates error message "Syntax error in INSERT INTO statement."
Dim Conn = Server.CreateObject("ADODB.Connection") 'Holds the Database Connection Object
' Dim rsGuestbook 'Holds the recordset for the records in the database
Dim strSQL As String 'Holds the SQL query to query the database
Conn.Open("Provider=Microsoft.Jet.OLEDB.4.0;
Data Source=c:\db1.mdb")
sql = "INSERT INTO Account (Fname,Lname,Address,Username,Password,Email,Activated) VALUES "
sql = sql & "('" & Request.Form("Fname") & "',"
sql = sql & "'" & Request.Form("Lname") & "',"
sql = sql & "'" & Request.Form("Address") & "',"
sql = sql & "'" & Request.Form("Username") & "',"
sql = sql & "'" & Request.Form("Password") & "',"
sql = sql & "'" & Request.Form("Email") & "',"
sql = sql & "'yes')"
sql = Replace(sql, "'", Chr(34))
'Exit Sub
Conn.Execute(sql) ' Crashed here with Syntax error in INSERT INTO statement.
Double checked the fields. Database file was created in Access 2000. Text fields are
Fname, Lname, Address, Username, Password, Email. Activated is a yes/no value.
Can't figure this out it looks valid.