Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

recordsets

Posted on 2000-05-11
5
Medium Priority
?
396 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 200 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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 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…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

916 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