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

Ask a Question related to ASP, Design and Development.

  1. #1

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

    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 Guest

  2. Similar Questions and Discussions

    1. Unable to create new page from copy of existing page
      I have issues when trying to create a new page from an existing web page on my site. I am only seeing the "blank document" option from the...
    2. Create the database connection without using CFAdministrator Page
      Anyone has idea of how to create the database connection without using the CF Administrator Data Source? I found an example of the cfquery with the...
    3. How to create two page spread with different page sizes for each.
      How can I create a two page spread and have each page be a different size. For example I would like to have page one be 3" wide and I would like to...
    4. ASP page works on IIS 5, not on 6
      I need some help... I am getting a Type Mismatch error on an ASP page that works fine on the a W2K server with IIS 5, but I have an exact copy of...
    5. go to net page not working in os 9, but works in x...
      heres the code on mouseup goToNetPage "http://www.yahoo.com" end works 100% in osx and 0% in os 9 locks up the projector forcing restart is...
  3. #2

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

    We got your first post.

    Ray at work

    <trimmed all>


    Ray at Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139