sql and ms access query: some records works other not..

Discussion in 'Database' started by bobrock4, Dec 21, 2010.

  1. bobrock4

    bobrock4 New Member

    Joined:
    Dec 21, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Ciao

    i'm a newbie, i seldom update an access mdb which is quiried from a web site. Inside that mdb there are users and passwords to access to a private area.

    After the latest mdb update users and pws don't work as before. Some works other not and I cannot understant what logic is behind it.

    I'm posting query sql code to find an help. I hope somebody could give me an hand.

    Bye



    codice:
    <%
    'Dimension variables
    Dim adoCon 'Database Connection Variable
    Dim strCon 'Holds the Database driver and the path and name of the database
    Dim rs 'Database Recordset Variable
    Dim strAccessDB 'Holds the Access Database Name
    Dim strSQL 'Database query sring
    Dim strUserName 'Holds the user name
    Dim url 'Holds the url

    Response.Buffer=True

    'If the session variable is False or does not exsist then redirect the user to the unauthorised user page
    If Session("blnIsUserGood") = False or IsNull(Session("blnIsUserGood")) = True then
    'Redirect to unathorised user page
    Response.Redirect"unauthorised_user_page.htm"
    End If

    'get the strUserName variable
    strUserName = Request.QueryString("name")

    'Check the database to see if user exsits and read in there password
    'Initialise the strAccessDB variable with the name of the Access Database
    strAccessDB = "users"

    'Create a connection odject
    Set adoCon = Server.CreateObject("ADODB.Connection")

    'Database connection info and driver
    strCon = "DRIVER={Microsoft Access Driver (*.mdb)};uid=;pwd=quicelapassword; DBQ=" & Server.MapPath(strAccessDB)

    'Set an active connection to the Connection object
    adoCon.Open strCon

    'Create a recordset object
    Set rs = Server.CreateObject("ADODB.Recordset")

    %>


    HERE THERE IS HTML CODE THEN

    codice:
    <%
    strSQL = "SELECT * FROM tblUsers WHERE tblUsers.UserID ='" & strUserName & "'"

    'Query the database

    rs.Open strSQL, strCon

    'Response.Write strQry & "<br><br>"


    set codi=rs.Fields("UserID")
    set desc=rs.Fields("Password")
    set url=rs.Fields("Link")
    set nom=rs.Fields("NOME")
    set cog=rs.Fields("COGNOME")
    nom_cog = "" & nom & " " & cog

    url_comp = "HERE THERE IS THE PATH" & desc &".pdf"



    if rs.EOF then
    %>
    <tr><td colspan="3" class="norbold" align="center">Nessun link disponibile</td></tr>
    <%
    else
    while not rs.EOF
    %>
    <br>Pagina di <b>
    <% =nom_cog %> </b>
    <tr>
    <td class="chi" align="left"> </td>
    <td class="chi" align="left"><a href="../utenti/<%=desc%>.pdf" target="_blank"><strong>Certificato esami</strong></a></td>
    <td class="chi" align="left"> </td>
    </tr>
    <tr>
    <td class="chi" align="left"></td>
    <td class="chi" align="center"> </td>
    <td class="chi" align="left"></td>
    </tr>
    <%
    rs.MoveNext
    wend
    end if
    rs.Close
    'Response.Redirect(url_comp)
    set rs=nothing
    'strCon.Close
    set strCon=nothing
    %>
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice