Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2004
    Posts
    3

    Angry Unanswered: MS Access DB does not take "Where" parameter?

    I am trying to use VB script in ASP with MS Access DB on IIS 6.
    I connected the DB, and can "select", "insert", and etc.
    But looks like Access doesn not let me do "select * from tablename where fieldname=valuehere"
    If I delete out the "where...", it works perfectly fine.
    So is it the limitation of access database?
    I know when I use Access DB with VB Script ASP, it will not allow "Recordset.MovePreviews", but is the "where..." syntax not allowed as well?
    Any help will be greatful.

  2. #2
    Join Date
    Dec 2004
    Location
    York, PA
    Posts
    95
    Where is valid so maybe it is the way you are trying to use it.

    Post some code so we can see

  3. #3
    Join Date
    Dec 2004
    Posts
    3
    <%
    username=request.Form("username")
    passwd=request.Form("passwd")

    if username="" or passwd="" then
    response.Redirect("default.asp")
    end if

    Dim DBCon
    Dim DBR

    Set DBCon = Server.CreateObject("ADODB.Connection")
    DBCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=e:\database\clerkprofile.mdb"
    Set DBR = Server.CreateObject("ADODB.Recordset")

    SQLString = "SELECT * FROM clerkinfo WHERE username=" & username
    DBR.open SQLString, DBCon

    if DBR.EOF or DBR("passwd")<>passwd then
    response.Redirect("default.asp")
    end if

    response.Cookies("ClerkID")("ID") = username
    response.Cookies("ClerkID")("FullName") = DBR("clerkname")
    response.Cookies("ClerkID")("Login") = "Yes"
    response.redirect("main.asp")
    %>
    <!--#include file="closedb.asp"-->

    Thanks for your help!!

  4. #4
    Join Date
    Dec 2004
    Location
    York, PA
    Posts
    95

    Thumbs up

    Ok this really is pretty simple
    I'm assumimg that Username is a textural field so the information needs to be passed in single quotes like this

    SQLString = "SELECT * FROM clerkinfo WHERE username='" & username & "'"
    DBR.open SQLString, DBCon

Posting Permissions

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