Print Page | Close Window

Logging Access

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=656
Printed Date: 28 March 2026 at 11:05pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Logging Access
Posted By: Dazz
Subject: Logging Access
Date Posted: 02 March 2003 at 10:45am

I want to use the following script to logg access to my pages however when i put in Request.ServerVariables("HTTP_USER_AGENT")
it stops working altogether does ayone have any idea why this is, your help would be greatly appreciated.
I have copyed the error message and put it at the bottom of this post

Regards

Daz

<%@ Language=VBScript %>
<%
'Dimension variables
Dim adoCon              'Holds the Database Connection Object
Dim rsAddinfo   'Holds the recordset for the new record to be added
Dim strSQL               'Holds the SQL query to query the database

'Create an ADO connection object
Set adoCon = Server.CreateObject("ADODB.Connection")

'Set an active connection to the Connection object using a DSN-less connection
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("errorlogs.mdb")

'Create an ADO recordset object
Set rsAddinfo = Server.CreateObject("ADODB.Recordset")
 
'Initialise the strSQL variable with an SQL statement to query the database
strSQL = "SELECT tblInfo.IP, tblInfo.Date, tblInfo.Software FROM tblInfo;"
 
'Set the cursor type we are using so we can navigate through the recordset
rsAddInfo.CursorType = 2

'Set the lock type so that the record is locked by ADO when it is updated
rsAddInfo.LockType = 3
 
'Open the recordset with the SQL query
rsAddInfo.Open strSQL, adoCon

'Tell the recordset we are adding a new record to it
rsAddInfo.AddNew

'Add a new record to the recordset
rsAddInfo.Fields("IP") = Request.ServerVariables("REMOTE_ADDR")
rsAddInfo.Fields("Date") = FormatDateTime(NOW)
rsAddInfo.Fields("Software") = Request.ServerVariables("HTTP_USER_AGENT")

'Write the updated recordset to the database
rsAddInfo.Update

'Reset server objects
rsAddInfo.Close
Set rsAddInfo = Nothing
Set adoCon = Nothing
%>

This is the error that i get

Microsoft OLE DB Provider for ODBC Drivers error '80040e21'

Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.

/asp/errorlog.asp, line 35




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net