Can't create ADODB connection on one web page but works on the next web page

Discussion in 'ASP General' started by Bina Desai, Oct 10, 2003.

  1. Bina Desai

    Bina Desai Guest

    I get the following error: Error Type:
    Microsoft VBScript runtime (0x800A01A8)
    Object required: ''
    /myweb4/authorised_user_page.asp, line 70


    and line 70 of my code is: <% rsCheckUser1.Open strSQL1,
    strcon1 %>

    Here is the full code:
    %
    dim adocon1
    dim strcon1
    Dim rsCheckUser1 'Database Recordset variable
    Dim strAccessDB1 'Holds the Access Database Name
    dim strSQL1 'Database query String
    Dim strUserName 'Holds the name of the user

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

    'Create a connection odject

    set adocon1 = Server.CreateObject("ADODB.Connection")

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

    'Set an active connection to the Connection object
    adocon1.open strcon1

    'Create a recordset object
    set rsCheckUser1 = Server.CreateObject("ADODB.Recordset")

    '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
    %>

    <html>
    <head>
    <title>Authorised User</title>
    <meta http-equiv="Content-Type" content="text/html;
    charset=iso-8859-1">





    'Get the users name passed from the previous page
    <% strUserName = Request.QueryString("name") %>


    </head>

    <body bgcolor="#FFFFFF" text="#000000">
    <!--
    <table width="518" border="0" cellspacing="0"
    cellpadding="0" align="center">
    <tr>
    <td align="center">
    <h1>Authorised Access</h1>
    </td>
    </tr>
    </table>
    <div align="center">
    <p><br>
    Welcome <b>
    <% =strUserName %>
    </b> to the password proteceted area of the web site.
    </p>
    <p>&nbsp;</p>
    -->

    <%

    strSQL1 = "select tblresults.userid,
    tblresults.date, tblresults.bf, tblresults.proteins,
    tblresults.othersolids from tblresults where
    tblresults.userid='" & strusername & "'" %>

    'Query the database
    <% rsCheckUser1.Open strSQL1, strcon1 %>
    <p>&nbsp;
    <table>
    <%do while not rscheckuser1.eof%>
    <tr><td><%response.write rscheckuser1
    ("UserID") %></td></tr>
    <tr><td><%response.write rscheckuser1
    ("Date") %></td></tr>
    <tr><td><%response.write rscheckuser1
    ("BF") %></td></tr>
    <tr><td><%response.write rscheckuser1
    ("Proteins") %></td></tr>
    <tr><td><%response.write rscheckuser1
    ("OtherSolids") %></td></tr>
    <tr><td><hr></td></tr>
    <%
    rscheckuser1.movenext
    loop
    %>
    </table>
    </p>


    </div>

    </body>
    </html>


    The only thing I am doing is bringing in the username
    value from the previous page and using that value to find
    all the records and display them on the current web
    page. I do not see what is wrong with my code. If
    anyone could please help.
     
    Bina Desai, Oct 10, 2003
    #1
    1. Advertising

  2. Bina Desai

    Ray at Guest

    We got your first post.

    Ray at work

    <trimmed all>
     
    Ray at, Oct 10, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Deniz Bahar
    Replies:
    2
    Views:
    477
    Andrey Tarasevich
    Mar 9, 2005
  2. Gary
    Replies:
    6
    Views:
    494
    Richard
    Aug 6, 2006
  3. Laurence Smith

    preformat works one day, gone the next

    Laurence Smith, Sep 3, 2008, in forum: HTML
    Replies:
    14
    Views:
    774
    Blinky the Shark
    Sep 5, 2008
  4. guy
    Replies:
    2
    Views:
    444
    Aaron Bertrand [MVP]
    Feb 23, 2004
  5. Avi
    Replies:
    2
    Views:
    153
    avisemah
    May 6, 2004
Loading...

Share This Page