1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Error message in login code (ASP classic + Access)

Discussion in 'ASP' started by leifoet, Feb 26, 2016.

  1. leifoet

    leifoet New Member

    Joined:
    Feb 26, 2016
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    HI Shabbir,

    For over 10 years I take care of the site for a hobby club. Because my original login (in FrontPage ASP) is not compatible for Apple and Android smartphones I want to change this login.
    Therefore I tried your (simple) ASP login code dated 19/08/2006 - see below.

    However, I keep getting the following error message :

    Microsoft JET Database Engine error '80040e10'
    No value given for one or more required parameters.
    /test_verify.asp, line 36

    line 36 => set rs=Conn.execute(SQLQuery)

    How can I solve this ?
    Thanks - Leifoet
    Code:
    <%
    'Connection String
    Dim Conn
    'Query to be executed
    Dim SQLQuery
    'Recordset
    Dim rs
    'StudentNo Of Logged in user
    Dim UserName
    'Password of User
    Dim Password
    
    'Getting information from submitted form
    UserName = request.form("username")
    Password = request.form("password")
    RememberMe = request.form("rememberme")
    
    
    'If not blank Username password submitted
    if UserName <> "" or Password <> "" then
        'Creating connection Object
        set Conn=server.createobject("ADODB.Connection")
        'Creating Recordset Object
        set rs = Server.CreateObject("ADODB.Recordset")
        'Initialising Provider String
        connStr = "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source="
        connStr = connStr + server.MapPath("_private/LOCO.mdb")
    
        'Opening Connection to Database
        Conn.open  connStr
        
        'Query to be executed
        SQLQuery = "select * from tblStudent where StudentNo = '"&UserName&"' AND Password = '"&Password&"'"
    
        'Retrieving recordset by executing SQL
    [B]    set rs=Conn.execute(SQLQuery)
    [/B]    'If no records retrieved
        if rs.BOF and rs.EOF then
            Response.Redirect "test_login.asp?username=" & UserName
        else 
            'If remember me selected
            if RememberMe = "ON" then
                'Writing cookies permanently
                Response.Cookies("UserName")=UserName
                Response.Cookies("Password")=Password
                Response.Cookies("UserName").Expires = Now() + 365
                Response.Cookies("Password").Expires = Now() + 365
                Response.Redirect "welcome.asp"
            else
                'writing cookies temporarily
                Response.Cookies("UserName")=UserName
                Response.Cookies("Password")=Password
                Response.Redirect "welcome.asp"
            end if
            'Closing all database connections
            Conn.Close
            rs.close   
            set rs = nothing
            set Conn = nothing
        end if
    else
        'Invalid User
        Response.Redirect "test_login.asp?UserName=blank"
    end if
    %>
     

Share This Page