|
 |
asp_databases thread: CursorType not getting set
Message #1 by "oliver dempsey" <dempseyoliver@h...> on Mon, 26 Feb 2001 22:22:11 -0000
|
|
Hi there,
Why is the CursorType etc. not getting set right when I write my code
like this:-
strConnect =3D "Provider=3DMicrosoft.Jet.OLEDB.4.0;" & _
"Data Source=3D "& server.mappath("RealEstate.mdb")&";"& _
"Persist Security Info=3DFalse"
Dim rsMainProperty
Set objConn =3D Server.CreateObject("ADODB.Connection")
Set rsMainProperty =3D Server.CreateObject("ADODB.Recordset")
objConn.Open strConnect
strSQL =3D "SELECT * FROM qryMainProperty WHERE SellerID =3D " & 45
rsMainProperty.CursorType =3D 0
rsMainProperty.CursorLocation =3D 2
rsMainProperty.LockType =3D 3
rsMainProperty.Open strSQL,objconn
When I used to write it like this, it was fine:-
'set rsMainProperty =3D Server.CreateObject("ADODB.Recordset")
'rsMainProperty.ActiveConnection =3D "dsn=3Dblahblah;"
'rsMainProperty.Source =3D "SELECT * FROM qryMainProperty WHERE SellerID
=3D " & 45
'rsMainProperty.CursorType =3D 0
'rsMainProperty.CursorLocation =3D 2
'rsMainProperty.LockType =3D 3
'rsMainProperty.Open
'rsMainProperty_numRows =3D 0
What's the difference?
Thanks and Best Regards
Oliver Dempsey
Message #2 by "Ken Schaefer" <ken@a...> on Tue, 27 Feb 2001 14:38:35 +1100
|
|
Oliver,
What is cursortype 0? and what is locktype 2?
(I can't be bothered looking them up for you)
Remember that the Jet OLEDB Provider only supports adOpenForwardOnly with
adLockReadOnly, and every other locktype gives you adOpenKeyset instead.
Cheers
Ken
----- Original Message -----
From: "oliver dempsey" <dempseyoliver@h...>
To: "ASP Databases" <asp_databases@p...>
Sent: Tuesday, February 27, 2001 9:22 AM
Subject: [asp_databases] CursorType not getting set
> Hi there,
> Why is the CursorType etc. not getting set right when I write my code
> like this:-
> strConnect =3D "Provider=3DMicrosoft.Jet.OLEDB.4.0;" & _
> "Data Source=3D "& server.mappath("RealEstate.mdb")&";"& _
> "Persist Security Info=3DFalse"
> Dim rsMainProperty
> Set objConn =3D Server.CreateObject("ADODB.Connection")
> Set rsMainProperty =3D Server.CreateObject("ADODB.Recordset")
> objConn.Open strConnect
> strSQL =3D "SELECT * FROM qryMainProperty WHERE SellerID =3D " & 45
> rsMainProperty.CursorType =3D 0
> rsMainProperty.CursorLocation =3D 2
> rsMainProperty.LockType =3D 3
> rsMainProperty.Open strSQL,objconn
>
>
> When I used to write it like this, it was fine:-
>
> 'set rsMainProperty =3D Server.CreateObject("ADODB.Recordset")
> 'rsMainProperty.ActiveConnection =3D "dsn=3Dblahblah;"
> 'rsMainProperty.Source =3D "SELECT * FROM qryMainProperty WHERE SellerID
> =3D " & 45
> 'rsMainProperty.CursorType =3D 0
> 'rsMainProperty.CursorLocation =3D 2
> 'rsMainProperty.LockType =3D 3
> 'rsMainProperty.Open
> 'rsMainProperty_numRows =3D 0
>
> What's the difference?
>
> Thanks and Best Regards
> Oliver Dempsey
Message #3 by "Oliver Dempsey" <odempsey@b...> on Tue, 27 Feb 2001 12:28:45 -0000
|
|
Hi Ken,
Thank you for your reply.
How is it that the when I write my code like this
set rsMainProperty = Server.CreateObject("ADODB.Recordset")
rsMainProperty.ActiveConnection = strdsn
rsMainProperty.Source = 45
rsMainProperty.CursorType = 0 (AdOpenForwardOnly)
rsMainProperty.CursorLocation = 2
rsMainProperty.LockType = 3 (adLockOptimistic )
rsMainProperty.Open
Response.write "<br>rsMainProperty.CursorType = "&rsMainProperty.CursorType
It works fine and the CursorType remains at 0
This code is generated by UltraDev
But when I write my code like this
strConnect = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source= "& server.mappath("RealEstate.mdb")&";"& _
"Persist Security Info=False"
Dim rsMainProperty
Set objConn = Server.CreateObject("ADODB.Connection")
Set rsMainProperty = Server.CreateObject("ADODB.Recordset")
objConn.Open strConnect
strSQL = 45
rsMainProperty.CursorType = 0 (AdOpenForwardOnly)
rsMainProperty.CursorLocation = 2
rsMainProperty.LockType = 3 (adLockOptimistic )
rsMainProperty.Open strSQL,objconn
Response.write "<br>rsMainProperty.CursorType = "&rsMainProperty.CursorType
It works but it seems to have changed the CursorType to 1 which is causing
me problems in my code further down. I could change the code to accommodate
it but I would like to solve this problem.
Thanks for your help
Oliver
'---- CursorTypeEnum Values ----
Const adOpenForwardOnly = 0
Const adOpenKeyset = 1
Const adOpenDynamic = 2
Const adOpenStatic = 3
'---- LockTypeEnum Values ----
Const adLockReadOnly = 1
Const adLockPessimistic = 2
Const adLockOptimistic = 3
Const adLockBatchOptimistic = 4
----- Original Message -----
From: Ken Schaefer <ken@a...>
To: ASP Databases <asp_databases@p...>
Sent: Tuesday, February 27, 2001 3:38 AM
Subject: [asp_databases] Re: CursorType not getting set
> Oliver,
>
> What is cursortype 0? and what is locktype 2?
> (I can't be bothered looking them up for you)
>
> Remember that the Jet OLEDB Provider only supports adOpenForwardOnly with
> adLockReadOnly, and every other locktype gives you adOpenKeyset instead.
>
> Cheers
> Ken
>
> ----- Original Message -----
> From: "oliver dempsey" <dempseyoliver@h...>
> To: "ASP Databases" <asp_databases@p...>
> Sent: Tuesday, February 27, 2001 9:22 AM
> Subject: [asp_databases] CursorType not getting set
>
>
> > Hi there,
> > Why is the CursorType etc. not getting set right when I write my code
> > like this:-
> > strConnect =3D "Provider=3DMicrosoft.Jet.OLEDB.4.0;" & _
> > "Data Source=3D "& server.mappath("RealEstate.mdb")&";"& _
> > "Persist Security Info=3DFalse"
> > Dim rsMainProperty
> > Set objConn =3D Server.CreateObject("ADODB.Connection")
> > Set rsMainProperty =3D Server.CreateObject("ADODB.Recordset")
> > objConn.Open strConnect
> > strSQL =3D "SELECT * FROM qryMainProperty WHERE SellerID =3D " & 45
> > rsMainProperty.CursorType =3D 0
> > rsMainProperty.CursorLocation =3D 2
> > rsMainProperty.LockType =3D 3
> > rsMainProperty.Open strSQL,objconn
> >
> >
> > When I used to write it like this, it was fine:-
> >
> > 'set rsMainProperty =3D Server.CreateObject("ADODB.Recordset")
> > 'rsMainProperty.ActiveConnection =3D "dsn=3Dblahblah;"
> > 'rsMainProperty.Source =3D "SELECT * FROM qryMainProperty WHERE SellerID
> > =3D " & 45
> > 'rsMainProperty.CursorType =3D 0
> > 'rsMainProperty.CursorLocation =3D 2
> > 'rsMainProperty.LockType =3D 3
> > 'rsMainProperty.Open
> > 'rsMainProperty_numRows =3D 0
> >
> > What's the difference?
> >
> > Thanks and Best Regards
> > Oliver Dempsey
>
>
>
>
Message #4 by "Ken Schaefer" <ken@a...> on Wed, 28 Feb 2001 10:51:08 +1100
|
|
Oliver,
Look in your MS Platform SDK.
http://www.adOpenStatic.com/resources/guide/gettingstarted/links.asp
As I said before, the Jet OLEDB Provider only supports the adOpenForwardOnly
cursor type with an adLockReadOnly locktype. If you try any other locktype
(eg adLockOptimistic) you will get an adOpenKeyset cursor instead.
There is nothing you can do about this - basically adOpenForwardOnly cursors
are not updateable when using Jet.OLEDB
Cheers
Ken
----- Original Message -----
From: "Oliver Dempsey" <odempsey@b...>
To: "ASP Databases" <asp_databases@p...>
Sent: Tuesday, February 27, 2001 11:28 PM
Subject: [asp_databases] Re: CursorType not getting set
> Hi Ken,
> Thank you for your reply.
> How is it that the when I write my code like this
>
> set rsMainProperty = Server.CreateObject("ADODB.Recordset")
> rsMainProperty.ActiveConnection = strdsn
> rsMainProperty.Source = 45
> rsMainProperty.CursorType = 0 (AdOpenForwardOnly)
> rsMainProperty.CursorLocation = 2
> rsMainProperty.LockType = 3 (adLockOptimistic )
> rsMainProperty.Open
> Response.write "<br>rsMainProperty.CursorType
"&rsMainProperty.CursorType
>
> It works fine and the CursorType remains at 0
> This code is generated by UltraDev
>
> But when I write my code like this
>
> strConnect = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
> "Data Source= "& server.mappath("RealEstate.mdb")&";"& _
> "Persist Security Info=False"
> Dim rsMainProperty
> Set objConn = Server.CreateObject("ADODB.Connection")
> Set rsMainProperty = Server.CreateObject("ADODB.Recordset")
> objConn.Open strConnect
> strSQL = 45
> rsMainProperty.CursorType = 0 (AdOpenForwardOnly)
> rsMainProperty.CursorLocation = 2
> rsMainProperty.LockType = 3 (adLockOptimistic )
> rsMainProperty.Open strSQL,objconn
> Response.write "<br>rsMainProperty.CursorType
"&rsMainProperty.CursorType
>
> It works but it seems to have changed the CursorType to 1 which is causing
> me problems in my code further down. I could change the code to
accommodate
> it but I would like to solve this problem.
>
> Thanks for your help
> Oliver
>
>
> '---- CursorTypeEnum Values ----
> Const adOpenForwardOnly = 0
> Const adOpenKeyset = 1
> Const adOpenDynamic = 2
> Const adOpenStatic = 3
>
> '---- LockTypeEnum Values ----
> Const adLockReadOnly = 1
> Const adLockPessimistic = 2
> Const adLockOptimistic = 3
> Const adLockBatchOptimistic = 4
>
Message #5 by "Oliver Dempsey" <odempsey@b...> on Wed, 28 Feb 2001 09:46:54 -0000
|
|
Hi Ken,
I didn't find anything helpful on that page.
I would like to get to the bottom of this thing. I want to know why
adlockoptimistic worked with adopenforwardonly in the first situation
whereas it didn't in the second.
Does the Microsoft.Jet.OLEDB provider support cursor types with different
lock types than the ODBC provider?
Regards
Oliver
|
|
 |