Cursor Constants

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

HI.

What rules or logic define what numerals are given to cursor constants?

For example:
const adOpenStatic = 3
const adLockOptimistic = 3
const adCmdText = 1

Could these have been set to ANY numeral?

Secondly, I noticed that the constants were set in the code by the previous
programmer but he did not USE them, that doesn't make sense on his connection
in the sql string he still typed out the cursor names.. so I am just trying
to come full circle in understanding so I am using the #'s.
 
No, you couldn't have set them to any numeric values. Those are the actual
values that the ADO library uses.

I'm not sure I understand your comment that "he did not USE them ... he
still typed out the cursor names". If you mean he used adOpenStatic rather
than 3 and adLockOptimistic rather than 3, that's the whole point of having
named constants. It's far easier to look at the OpenRecordset command with
named constants and figure out what's supposed to be happening than looking
at one with numeric values used instead.
 
That makes sense what you are saying for example:
prst.Open psql, pcon, adOpenStatic, adLockOptimistic

But that leads me back to wondering why ever display this in your code at
the top of the .asp page?
const adOpenStatic = 3
const adLockOptimistic = 3
const adLockReadOnly = 1
const adCmdText = 1

Lastly, if for example adOpenStatic is ALWAYS 3 then it would not take very
long to memorize that..

But anyway.. seems that then write out the cursors in your connection
opening and forget about declaring constants?

Thank you very much.
 
ASP doesn't let you include libraries like you can in, say, Access. That
means you have to define the named constants if you want to be able to use
them in your code.

You don't have to: you can use prst.Open psql, pcon, 3, 3 if you want to,
but are you going to remember what those values mean when you go back to
look at the code in a month?
 
Back
Top