Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2005
    Posts
    1

    Unanswered: ASP ADO Connection

    Urgent! PLEASE HELP!

    I couldn't figure out what's the errors of my coding..

    <%
    Dim rsLogin, rsTime, strConn

    strConn="Provider=Microsoft.Jet.OLEDB.4.0;" &_
    "Data Source=" & Server.MapPath("Users.mdb")

    Set rsLogin = Server.CreateObject("ADODB.Recordset")
    Set rsTime = Server.CreateObject("ADODB.Recordset")

    'Get userid and password'
    userid = Request.Form("uid")
    password = Request.Form("pwd")

    'Assume an invalid logon'
    validLogon = False

    'Construct SQL Statement'
    SQLCommand1 = "Select * From Acc Where UserName = '" _
    & userid & "'"
    SQLCommand2 = "Select * From LogFile"

    rsLogin.Open SQLCommand1, strConn, 1, 3
    rsTime.Open SQLCommand2, strConn, 2, 3

    If Not rsLogin.EOF And Not rsLogin.BOF Then
    If password = obj.Fields("Password") Then
    validLogon = true
    Response.Direct "menu.asp"
    rsTime.Close
    set rsTime = nothing
    Else
    response.redirect "loginerror.asp"
    End If
    Else
    response.redirect "loginerror.asp"
    End if

    rsLogin.Close
    set rsLogin = nothing
    %>

    Error Type:
    Microsoft JET Database Engine (0x80004005)
    Could not use ''; file already in use.
    /Web 051114/login.asp, line 23

    Anyone knows what is going on with the coding?

    Thanks

  2. #2
    Join Date
    Apr 2005
    Posts
    28
    Why do you Close rslogin and set it to nothing but you don't do the same for the other Recordset you opened.... rstime...?

    Quote Originally Posted by sasa82
    Urgent! PLEASE HELP!

    I couldn't figure out what's the errors of my coding..

    <%
    Dim rsLogin, rsTime, strConn

    strConn="Provider=Microsoft.Jet.OLEDB.4.0;" &_
    "Data Source=" & Server.MapPath("Users.mdb")

    Set rsLogin = Server.CreateObject("ADODB.Recordset")
    Set rsTime = Server.CreateObject("ADODB.Recordset")

    'Get userid and password'
    userid = Request.Form("uid")
    password = Request.Form("pwd")

    'Assume an invalid logon'
    validLogon = False

    'Construct SQL Statement'
    SQLCommand1 = "Select * From Acc Where UserName = '" _
    & userid & "'"
    SQLCommand2 = "Select * From LogFile"

    rsLogin.Open SQLCommand1, strConn, 1, 3
    rsTime.Open SQLCommand2, strConn, 2, 3

    If Not rsLogin.EOF And Not rsLogin.BOF Then
    If password = obj.Fields("Password") Then
    validLogon = true
    Response.Direct "menu.asp"
    rsTime.Close
    set rsTime = nothing
    Else
    response.redirect "loginerror.asp"
    End If
    Else
    response.redirect "loginerror.asp"
    End if

    rsLogin.Close
    set rsLogin = nothing
    %>

    Error Type:
    Microsoft JET Database Engine (0x80004005)
    Could not use ''; file already in use.
    /Web 051114/login.asp, line 23

    Anyone knows what is going on with the coding?

    Thanks

Posting Permissions

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