By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,930 Members | 1,682 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,930 IT Pros & Developers. It's quick & easy.

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

P: n/a
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

'Set an active connection to the Connection object 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
End If

<title>Authorised User</title>
<meta http-equiv="Content-Type" content="text/html;

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

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


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

'Query the database
<% rsCheckUser1.Open strSQL1, strcon1 %>
<%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>

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.
Jul 19 '05 #1
Share this Question
Share on Google+
1 Reply

P: n/a
We got your first post.

Ray at work

<trimmed all>
Jul 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.