Solved

recordsets

Posted on 2000-05-11
5
392 Views
Last Modified: 2008-02-01
another simple question.

whats wrong with this?

objRS.Open "Products", objConn, adOpenForwardOnly, adLockReadOnly, adCmdTable

0
Comment
Question by:philcrouch
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 4

Expert Comment

by:CoolAss
ID: 2803453
Heheha... um... well, noting!

But that completely depends on some things:

1.) What are you trying to do?

2.) What is the error your getting.

3.) How do you define objRS and objConn?
0
 

Author Comment

by:philcrouch
ID: 2803475
i set it up like this.....


'Open a connection to the database
      Dim objConn
      Set objConn = Server.CreateObject("ADODB.Connection")
      objConn.ConnectionString = "DSN=TestDB"
      objConn.Open
      
      'Get the table information for products
      Dim objRS
      Set objRS = Server.CreateObject("ADODB.Recordset")
      objRS.Open "Products", objConn, adOpenForwardOnly, adLockReadOnly, adCmdTable
      


and get this error.  i am not sure what i am doing, but i think the paramters are for security


here is the error
Error Type:
Microsoft VBScript runtime (0x800A01F4)
Variable is undefined: 'adOpenForwardOnly'
/members/listproducts.asp, line 35
0
 
LVL 18

Accepted Solution

by:
mgfranz earned 50 total points
ID: 2803477
You need to either define the constants with adovbs.inc include, or change the locks to numeric values.  Try this;

<!--#include file="adovbs.inc"-->



'Open a connection to the database
Dim objConn
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.ConnectionString = "DSN=TestDB"
objConn.Open

'Get the table information for products
Dim objRS
Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.Open "Products", objConn, adOpenForwardOnly, adLockReadOnly, adCmdTable

Or...;



'Open a connection to the database
Dim objConn
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.ConnectionString = "DSN=TestDB"
objConn.Open

'Get the table information for products
Dim objRS
Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.Open "Products", objConn, 3, 3


0
 
LVL 2

Expert Comment

by:bbala
ID: 2803482
the constants adopenforwardonly are defined in a file called adovbs.inc
sometimes it mey be included automatically under ur home directory, if not it may give this error either u urself include the adovbs.inc file in ur asp file or say
objrs.open "products",objconn,1,1
i.e use numbers corresponding to the constants

i am not sure of the numbers cooresponding for the constants if u want i will tell u
0
 

Author Comment

by:philcrouch
ID: 2803489
thanks for the help.....

0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
FileUp - Classic ASP 5 27
edit .asp files 5 61
Executing a script on a timer online 5 45
SQL help please 15 37
I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

751 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