Blueie Posted June 1, 2014 Share Posted June 1, 2014 Hello I am trying to follow the tutorial here: http://www.w3schools.com/website/web_asp_login.asp except that I have added one more field for email. However, I am getting the following error message: Microsoft JET Database Engine error '80040e14' Syntax error in INSERT INTO statement. /schoolsReg/Register1.asp, line 45 Line 45 is this: conn.Execute(sql), but the INSERT INTO statement is on the above line: sql="INSERT INTO userlist (username, password, strEmail) VALUES ('" & username & "','" & password & "', 'strEmail')" The rest of the code looks like this: <%username = ""password = ""confirmPassword = ""strEmail = ""ErrorMessage = ""if request.form <> "" thenusername = Request.Form("username")password = Request.Form("password")confirmPassword = Request.Form("confirmPassword")strEmail = Request.Form("strEmail") if strEmail="" or password="" then ErrorMessage = "You must specify both email and password." end if if password <> confirmPassword then ErrorMessage = "Password and confirmation do not match." end if if ErrorMessage = "" then set conn = Server.CreateObject("ADODB.Connection") conn.Provider = "Microsoft.Jet.OLEDB.4.0" conn.Open("E:myDatabase.mdb") set rs = Server.CreateObject("ADODB.recordset") rs.Open "Select * FROM userlist WHERE strEmail = '" & strEmail & "'", conn if rs.EOF = true then sql="INSERT INTO userlist (username, password, strEmail) VALUES ('" & username & "','" & password & "', 'strEmail')" conn.Execute(sql) Response.Redirect("Default.asp") else ErrorMessage = "Email address is already in use." end if end ifend ifif ErrorMessage <> "" then response.write("<p>" & ErrorMessage & "</p>") response.write("<p>Please correct the errors and try again.</p>") end if%><h1>Register</h1><form method="post" action=""> <fieldset><legend>Sign-up Form</legend><ol><li> <label>Username:</label><input type="text" id="username" name="username" /> </li><li><label>Password:</label><input type="password" id="password" name="password" /></li><li><label>Confirm Password:</label><input type="password" id="confirmPassword" name="confirmPassword" /></li><li> <label>Email:</label><input type="text" id="strEmail" name="strEmail" /> </li><li><p><input type="submit" value="Register" /></p></li></ol></fieldset></form> Link to comment Share on other sites More sharing options...
justsomeguy Posted June 2, 2014 Share Posted June 2, 2014 I don't see a syntax error, although it's not going to insert the email from the form. Print out the query so that you can see what it looks like when it goes to the database. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now