Monday, March 26, 2012

I wonder if these ADO constants really work at all

For example why doesn't this give an error?
In a ASP:
<%@.language=3D"VBScript"%>
<%
'...
sSQL =3D "SELECT CustomerID, CompanyName, " & _=20
"ContactName, Country FROM Customers"
Set rs =3D Server.CreateObject("ADODB.Recordset")
rs.CursorType =3D adOpenForwardOnly
rs.Open sSQl, Application("DBconn")
rs.MoveNext
%>
<!-- HTML stuff -->
<%
rs.MoveFirst
'...
%>
<!-- HTML and ASP stuff -->
SQL 2000 SP3 ADO 2.7 SP(not sure) Windows 2000 SP3
--=20
George Hester
__________________________________
What error were you expecting?
http://www.aspfaq.com/
(Reverse address to reply.)
"George Hester" <hesterloli@.hotmail.com> wrote in message
news:%23uESkwAXEHA.2908@.TK2MSFTNGP10.phx.gbl...
For example why doesn't this give an error?
|||> What error were you expecting?
About using forward only cursor backward.
I have seen an error in similar situation, but can't verify this now
|||Right. What I provided should have resulted in a error but did not. =
The adForwardOnly constant is NOT working. rs.MoveNext followed by =
rs.MoveFirst should have resulted in a error at least that is my =
understanding of a Recordset opened with that cursor type =
adForwardOnly..
--=20
George Hester
__________________________________
"Bojidar Alexandrov" <bojo_do_no_spam@.kodar.net> wrote in message =
news:OhiQ$IGXEHA.128@.TK2MSFTNGP10.phx.gbl...
>=20
> About using forward only cursor backward.
>=20
> I have seen an error in similar situation, but can't verify this now
>=20
>
|||I'm not going to presume to know the reason(s) why, but MoveFirst() allows
you to just start over. The problem you will have with certain cursor types
is that you will not be able to move backwards, e.g. MovePrevious(). Also,
try a MoveLast() then a MoveFirst().
http://www.aspfaq.com/
(Reverse address to reply.)
"George Hester" <hesterloli@.hotmail.com> wrote in message
news:ud6NnQKXEHA.1652@.TK2MSFTNGP09.phx.gbl...
Right. What I provided should have resulted in a error but did not. The
adForwardOnly constant is NOT working. rs.MoveNext followed by rs.MoveFirst
should have resulted in a error at least that is my understanding of a
Recordset opened with that cursor type adForwardOnly..
|||On Sun, 27 Jun 2004 02:01:06 -0400, "George Hester"
<hesterloli@.hotmail.com> wrote:
>For example why doesn't this give an error?
My experience with ADO is that if you give a set of parameters that is
supposed to work, it will work, and if you give a set of parameters
that is an any way faulty, results are unpredictable in advance and
error messages unlikely.
I suspect this is pretty much as far as Microsoft's design and
development of ADO reaches.
J.
|||On Sun, 27 Jun 2004 02:01:06 -0400, "George Hester"
<hesterloli@.hotmail.com> wrote:
>For example why doesn't this give an error?
My experience with ADO is that if you give a set of parameters that is
supposed to work, it will work, and if you give a set of parameters
that is an any way faulty, results are unpredictable in advance and
error messages unlikely.
I suspect this is pretty much as far as Microsoft's design and
development of ADO reaches.
J.
|||Aaron I am not sure I follow what you were saying. Are you saying that =
what I presented is not supposed to give an error? If that is the case =
could you please clarify if setting the cursor as adOpenForwardOnly and =
then moving the Recordset rs.MoveNext and later rs.MoveFirst is not =
contradicting the definition of adOpenForwardOnly? Because I seem to =
misunderstand the definition of adOpenForwardOnly then. Thanks.
--=20
George Hester
__________________________________
"Aaron [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message =
news:OmdlQpRXEHA.3168@.TK2MSFTNGP10.phx.gbl...
> I'm not going to presume to know the reason(s) why, but MoveFirst() =
allows
> you to just start over. The problem you will have with certain cursor =
types
> is that you will not be able to move backwards, e.g. MovePrevious(). =
Also,
> try a MoveLast() then a MoveFirst().
>=20
> --=20
> http://www.aspfaq.com/
> (Reverse address to reply.)
>=20
>=20
>=20
>=20
> "George Hester" <hesterloli@.hotmail.com> wrote in message
> news:ud6NnQKXEHA.1652@.TK2MSFTNGP09.phx.gbl...
> Right. What I provided should have resulted in a error but did not. =
The
> adForwardOnly constant is NOT working. rs.MoveNext followed by =
rs.MoveFirst
> should have resulted in a error at least that is my understanding of a
> Recordset opened with that cursor type adForwardOnly..
>=20
>
|||Hi Aaron. I changed rs.MoveFirst to rs.MovePrevious and got the error =
as expected. "Operation is not allowed in this context." Well that's =
good. I guess rs.MoveFirst after one rs.MoveNext is different then =
rs.MovePrevious after one rs.MoveNext. Because the later errors but the =
former does not. Mmmm...
--=20
George Hester
__________________________________
"Aaron [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message =
news:OmdlQpRXEHA.3168@.TK2MSFTNGP10.phx.gbl...
> I'm not going to presume to know the reason(s) why, but MoveFirst() =
allows
> you to just start over. The problem you will have with certain cursor =
types
> is that you will not be able to move backwards, e.g. MovePrevious(). =
Also,
> try a MoveLast() then a MoveFirst().
>=20
> --=20
> http://www.aspfaq.com/
> (Reverse address to reply.)
>=20
>=20
>=20
>=20
> "George Hester" <hesterloli@.hotmail.com> wrote in message
> news:ud6NnQKXEHA.1652@.TK2MSFTNGP09.phx.gbl...
> Right. What I provided should have resulted in a error but did not. =
The
> adForwardOnly constant is NOT working. rs.MoveNext followed by =
rs.MoveFirst
> should have resulted in a error at least that is my understanding of a
> Recordset opened with that cursor type adForwardOnly..
>=20
>
|||Hi Aaron. I changed rs.MoveFirst to rs.MovePrevious and got the error =
as expected. "Operation is not allowed in this context." Well that's =
good. I guess rs.MoveFirst after one rs.MoveNext is different then =
rs.MovePrevious after one rs.MoveNext. Because the later errors but the =
former does not. Mmmm...
--=20
George Hester
__________________________________
"Aaron [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message =
news:OmdlQpRXEHA.3168@.TK2MSFTNGP10.phx.gbl...
> I'm not going to presume to know the reason(s) why, but MoveFirst() =
allows
> you to just start over. The problem you will have with certain cursor =
types
> is that you will not be able to move backwards, e.g. MovePrevious(). =
Also,
> try a MoveLast() then a MoveFirst().
>=20
> --=20
> http://www.aspfaq.com/
> (Reverse address to reply.)
>=20
>=20
>=20
>=20
> "George Hester" <hesterloli@.hotmail.com> wrote in message
> news:ud6NnQKXEHA.1652@.TK2MSFTNGP09.phx.gbl...
> Right. What I provided should have resulted in a error but did not. =
The
> adForwardOnly constant is NOT working. rs.MoveNext followed by =
rs.MoveFirst
> should have resulted in a error at least that is my understanding of a
> Recordset opened with that cursor type adForwardOnly..
>=20
>
sql

No comments:

Post a Comment