Solved

Variable is undefined: 'adOpenKeyset'

Posted on 2004-09-07
7
1,337 Views
Last Modified: 2010-05-18
I'm not a programmer, so please bear with me. My buddy wrote the page, and I can usually go in and figure out many of my issues, but I honestly don't know what "adOpenKeyset" is, or if it's even necessary on this page. I tried deleting it, trying other "adOpen" commands, but nothing worked.

I'm not sure what happened. This page has been working fine for a year or two, and suddenly it decided to break. Is there a chance my hosting server made a change that broke this?

The error is as stated in the title: Variable is undefined: 'adOpenKeyset'

Here is a copy of the first portion of the code:

<%@ Language=VBScript %>
<% Option Explicit %>
<%
'-------------------------------------------------------------------------------
' Author:         LM
' Create Date:    12/22/2002
' Page Function:  This page previews an ad from the database
'-------------------------------------------------------------------------------
      Dim dcnDB                         ' As ADODB.Connection
      Dim strDatabaseLocation           ' As String
      Dim rsQuery                               ' As ADODB.Connection
       Dim strMESSAGE                  ' As String
       Dim strNAME                     ' As String
      Dim rsORDER                               ' As ADODB.Recordset
      Dim strORDER                         ' As String
      Dim strEMAIL                               ' As String

      strNAME = Request.Form("CName")
      
%>
<!--#INCLUDE FILE="includes/ConnectDatabase1.inc"-->
<%
      Set rsQuery = Server.CreateObject("ADODB.Recordset")
      rsQuery.Open "SELECT * FROM ads", dcnDB, adOpenKeyset, adLockOptimistic


'-------------------------------------------------------------------------------
'  Defines session values
'-------------------------------------------------------------------------------
      
    SessionValues

'-------------------------------------------------------------------------------
'  Checks to make sure required fields filled out
'-------------------------------------------------------------------------------
      
    CheckForm1
      
%>

<HTML>
0
Comment
Question by:lawrance4
  • 3
7 Comments
 
LVL 41

Expert Comment

by:shanesuebsahakarn
ID: 12001566
Your include file probably no longer includes a definition of adOpenKeyset - that would be the place to check first. It's a constant value.

For reference, it is equal to 1, so you might try this:
rsQuery.Open "SELECT * FROM ads", dcnDB, 1, adLockOptimistic
0
 

Author Comment

by:lawrance4
ID: 12001655
I tried your suggestion and got this:

Variable is undefined: 'adLockOptimistic'

I haven't changed my include file either, but here is what the "ConnectDatabase1.inc"  file contains:

<%
      strDatabaseLocation = "D:\Websites\www.fsbo-indy.com\database\fsboindy.mdb"
      Set dcnDB = Server.CreateObject("ADODB.Connection")
      dcnDB.ConnectionString = _
         "Provider=Microsoft.Jet.OLEDB.4.0;" _
            & "Persist Security Info=False;Data Source=" _
            & strDatabaseLocation
      dcnDB.Open
%>
0
 
LVL 41

Expert Comment

by:shanesuebsahakarn
ID: 12001706
Thinking about it, it wouldn't be defined in your include file at all (sorry, I don't use ASP all that much). It is very possible that your host has made some changes which has caused your code to stop working.
0
 
LVL 41

Accepted Solution

by:
shanesuebsahakarn earned 500 total points
ID: 12001717
Sounds like the ADOVBS.INC file has been removed, where this stuff should be declared. Have a look here:
http://www.asp101.com/articles/john/adovbs/default.asp
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question