www.webdeveloper.com
Results 1 to 6 of 6

Thread: Problem with ASP Register form

  1. #1
    Join Date
    Mar 2013
    Posts
    26

    Exclamation Problem with ASP Register form

    Hi Guys,

    I have been working on a new website however when parsing registration I am getting an error, Could someone correct my mistake please?

    Here's the Error I am getting:
    Microsoft VBScript compilation error '800a0409'

    Unterminated string constant

    /vb14apps/Register.asp, line 36

    sql="INSERT INTO Users (Email,Password,Role)
    --------------------------------------------^

    Code:
    <%
    email = ""
    password = ""
    confirmPassword = ""
    ErrorMessage = ""
    
    if request.form <> "" then
      email = Request.Form("email")
      password = Request.Form("password")
      confirmPassword = Request.Form("confirmPassword")
    
      if email="" 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"
    DSNtest=dsntest & Server.MapPath("./Users.mdb")
    Conn.Open DSNtest
        set rs = Server.CreateObject("ADODB.recordset")
        rs.Open "Select * FROM Users WHERE Email = '" & email & "'", conn
        if rs.EOF = true then
         sql="INSERT INTO Users (Email,Password,Role)
          VALUES ('" & email & "','" & password & "','guest')"
          conn.Execute(sql)
          Response.Redirect("Default.asp")
        else
          ErrorMessage = "Email address is already in use."
        end if
      end if
    end if
    
    if ErrorMessage <> "" then
      response.write("<p>" & ErrorMessage & "</p>") 
      response.write("<p>Please correct the errors and try again.</p>") 
    end if
    %>
    If someone can correct my problem I would be very much appreciated!

    Thanks!

  2. #2
    Join Date
    Sep 2011
    Posts
    60
    Quote Originally Posted by wolveriene401 View Post
    Hi Guys,

    I have been working on a new website however when parsing registration I am getting an error, Could someone correct my mistake please?

    Here's the Error I am getting:
    Microsoft VBScript compilation error '800a0409'

    Unterminated string constant

    /vb14apps/Register.asp, line 36

    sql="INSERT INTO Users (Email,Password,Role)
    --------------------------------------------^

    Code:
    <%
    email = ""
    password = ""
    confirmPassword = ""
    ErrorMessage = ""
    
    if request.form <> "" then
      email = Request.Form("email")
      password = Request.Form("password")
      confirmPassword = Request.Form("confirmPassword")
    
      if email="" 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"
    DSNtest=dsntest & Server.MapPath("./Users.mdb")
    Conn.Open DSNtest
        set rs = Server.CreateObject("ADODB.recordset")
        rs.Open "Select * FROM Users WHERE Email = '" & email & "'", conn
        if rs.EOF = true then
         sql="INSERT INTO Users (Email,Password,Role)
          VALUES ('" & email & "','" & password & "','guest')"
          conn.Execute(sql)
          Response.Redirect("Default.asp")
        else
          ErrorMessage = "Email address is already in use."
        end if
      end if
    end if
    
    if ErrorMessage <> "" then
      response.write("<p>" & ErrorMessage & "</p>") 
      response.write("<p>Please correct the errors and try again.</p>") 
    end if
    %>
    If someone can correct my problem I would be very much appreciated!

    Thanks!
    the problem is new line after
    sql="INSERT INTO Users (Email,Password,Role)
    it is creates unterminated string...
    change sql="INSERT INTO Users (Email,Password,Role)
    VALUES ('" & email & "','" & password & "','guest')"
    to sql="INSERT INTO Users (Email,Password,Role) VALUES ('" & email & "','" & password & "','guest')"

  3. #3
    Join Date
    Mar 2013
    Posts
    26
    Thanks, I updated that!
    <%
    email = ""
    password = ""
    confirmPassword = ""
    ErrorMessage = ""

    if request.form <> "" then
    email = Request.Form("email")
    password = Request.Form("password")
    confirmPassword = Request.Form("confirmPassword")

    if email="" 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"
    DSNtest=dsntest & Server.MapPath("./Users.mdb")
    Conn.Open DSNtest
    set rs = Server.CreateObject("ADODB.recordset")
    rs.Open "Select * FROM Users WHERE Email = '" & email & "'", conn
    if rs.EOF = true then
    sql="INSERT INTO Users (Email,Password,Role) VALUES ('" & email & "','" & password & "','guest')"
    conn.Execute(sql)
    Response.Redirect("Default.asp")
    else
    ErrorMessage = "Email address is already in use."
    end if
    end if
    end if

    if ErrorMessage <> "" then
    response.write("<p>" & ErrorMessage & "</p>")
    response.write("<p>Please correct the errors and try again.</p>")
    end if
    %>
    however I am now getting the following error:
    Microsoft JET Database Engine error '80040e14'

    Syntax error in INSERT INTO statement.

    /vb14apps/Register.asp, line 38



    Please help!

    Thanks.

  4. #4
    Join Date
    Mar 2013
    Posts
    26

    Question Any help??

    Anyone help with my problem?


    Please read previous post.



    Thanks

  5. #5
    Join Date
    Jun 2014
    Posts
    8
    I think inverted commas in insert statement is not correct.....

    Thanks

  6. #6
    Join Date
    Apr 2014
    Posts
    34
    Please write did you decide your problem with "Unterminated string constant"?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles