Solved

recordsets

Posted on 2000-05-11
5
387 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
This is a video describing the growing solar energy use in Utah. This is a topic that greatly interests me and so I decided to produce a video about it.
This is a video that shows how the OnPage alerts system integrates into ConnectWise, how a trigger is set, how a page is sent via the trigger, and how the SENT, DELIVERED, READ & REPLIED receipts get entered into the internal tab of the ConnectWise …

929 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now