Submit Your Article Forum Rules

Results 1 to 5 of 5

Thread: ASP & ACCESS

  1. #1
    Junior Member seto_kaiba's Avatar
    Join Date
    Dec 2003
    Posts
    28

    ASP & ACCESS

    Can sombody please help me?? I now realize that perhaps it would have been easier to use PHP to do this, however I do not really have the time to start over now. I am trying to create a user logon to protect some of the pages on a clients website using ACCESS and ASP Scripting and am having alot of problems with my scripting.

    Here is the code I am attempting to use:
    <%

    Dim adoCon
    Dim strSQL
    Dim rslogin
    Dim strCon
    Dim DbasePath

    DbasePath = "fpdb/user_login.mdb"

    strCon = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & DbasePath

    Set adoCon = Server.CreateObject("ADODB.Connection")

    adoCon.ConnectionString = strCon

    adoCon.Open

    Dim GetUsername
    Dim GetPassword
    Dim GetAccess

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

    GetUsername = Request.Form("usernamebox")
    GetPassword = Request.Form("passwordbox")
    If GetUsername <> "" AND GetPassword <> "" Then
    strSQL = "SELECT * FROM tblLogin WHERE username = '" & GetUsername & "' AND password = '" & GetPassword & "'"
    rsLogin.open strSQL, adoCon
    If not rsLogin.EOF Then
    GetAccess = rsLogin("accesslevel")
    Session("AccessLevel") = GetAccess
    Response.Redirect("practice_001.htm")
    Else
    Response.Redirect("access_denied.htm")
    End If
    Else
    Response.Redirect("access_denied.htm")
    End If

    %>

    The problem that keeps on occuring involes actually being able to find and pull information from the ACCESS Database though the asp code.

    Can someone please point me in the right direction?

    Thanks a bunch!!

  2. #2
    Junior Member
    Join Date
    Sep 2003
    Posts
    21
    I use ASP and Access on my web sites - so, I should be able to help. What is the specific error message you're getting.

  3. #3
    Senior Member
    Join Date
    Jul 2003
    Posts
    170

    Access & ASp

    Can I suggest that you go to http://www.aspin.comand download one of the free p/w protection scripts. It's the easiest way!

  4. #4

    ASP/Access login

    I do a lot of ASP with Access. The problem is not immediately obvious.

    In fact, for my logins I use the Spooky Login http://www.outfront.net. You get a lot of functionality for not much money.

  5. #5
    Junior Member
    Join Date
    Sep 2003
    Posts
    21
    Here are a couple of observations after a short review of your code.

    The database path must be a complete physical path. If you don't know the physical path, use "Server.MapPath" to get it. The path you're using doesn't have the drive identifier, and it looks like a relative path to me - not a physical path.

    You didn't show the code to close the recordset and connection and free up those resources. Hopefully this code is at another location on the page. If not, you will use up all of the connections in your connection pool. After that point, you will not be able to get a new connection until the connection resources have been scavenged by a garbabe collector or the web application has been restarted.

    Here is how you should free those resources.

    objRS.Close
    Set objRS = Nothing
    objConn.Close
    Set objConn = Nothing

    If you need it, I can send you a listing of my logon processing (ASP + Access) as a recipe for your coding.

Similar Threads

  1. Access to Ms Sql ??
    By godhands in forum Database Discussion Forum
    Replies: 10
    Last Post: 12-08-2008, 12:25 AM
  2. Access to MySql to Access
    By Fendermate in forum Database Discussion Forum
    Replies: 3
    Last Post: 10-06-2005, 11:03 AM
  3. Can't access my own website
    By asya in forum Internet Security Discussion Forum
    Replies: 6
    Last Post: 08-02-2004, 02:29 PM
  4. access database access
    By tfinch in forum Web Programming Discussion Forum
    Replies: 6
    Last Post: 07-27-2004, 10:28 PM

Posting Permissions

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