|
 |
asp_databases thread: Question Adding Cursor Types and Locks using ADODB.Command
Message #1 by "Tom Garrison" <tom.garrison@e...> on Thu, 13 Sep 2001 21:08:21
|
|
I am not sure how to do this and can not find the answer in any books. I
know how to set them using ADODB.Recordset (rs.Open sql, db,
adOpenForwardOnly, adLockReadOnly, adCmdText). However, when I try to set
them using ADODB.Command using the following syntax I get an error:
set objComm = Server.CreateObject ("ADODB.Command")
objComm.CursorType = adOpenDynamic
objComm.ActiveConnection = db
objComm.CommandText = sql
objComm.CommandType = adCmdText
Set rs = objComm.Execute
Set objComm = Nothing
The ObjComm.CursorType causes this error: Object doesn't support this
property or method: 'CursorType'
Any ideas how to get around this? If I don't set a cursor type it works,
but when I try to move backwards through the recordset, I get an error (I
think it defaults to adOpenForwardOnly). I am also concerned about
locking in case I want to use this methodology for adds and updates.
Thanks,
Tom
Message #2 by Chris Zuniga <Chris.Zuniga@g...> on Thu, 13 Sep 2001 15:30:14 -0500
|
|
Right. I've even tried the adOpenStatic CursorType, and I still only get
"-1". Sorry I can't help you more.
CZ
-----Original Message-----
From: Tom Garrison [mailto:tom.garrison@e...]
Sent: Thursday, September 13, 2001 4:08 PM
To: ASP Databases
Subject: [asp_databases] Question Adding Cursor Types and Locks using
ADODB.Command
I am not sure how to do this and can not find the answer in any books. I
know how to set them using ADODB.Recordset (rs.Open sql, db,
adOpenForwardOnly, adLockReadOnly, adCmdText). However, when I try to set
them using ADODB.Command using the following syntax I get an error:
set objComm = Server.CreateObject ("ADODB.Command")
objComm.CursorType = adOpenDynamic
objComm.ActiveConnection = db
objComm.CommandText = sql
objComm.CommandType = adCmdText
Set rs = objComm.Execute
Set objComm = Nothing
The ObjComm.CursorType causes this error: Object doesn't support this
property or method: 'CursorType'
Any ideas how to get around this? If I don't set a cursor type it works,
but when I try to move backwards through the recordset, I get an error (I
think it defaults to adOpenForwardOnly). I am also concerned about
locking in case I want to use this methodology for adds and updates.
Thanks,
Tom
Message #3 by "Tomm Matthis" <matthis@b...> on Thu, 13 Sep 2001 16:39:54 -0400
|
|
Set the type in the connection object, not the command object.
-- Tomm
> -----Original Message-----
> From: Tom Garrison [mailto:tom.garrison@e...]
> Sent: Thursday, September 13, 2001 9:08 PM
> To: ASP Databases
> Subject: [asp_databases] Question Adding Cursor Types and Locks using
> ADODB.Command
>
>
> I am not sure how to do this and can not find the answer in any books. I
> know how to set them using ADODB.Recordset (rs.Open sql, db,
> adOpenForwardOnly, adLockReadOnly, adCmdText). However, when I
> try to set
> them using ADODB.Command using the following syntax I get an error:
>
> set objComm = Server.CreateObject ("ADODB.Command")
> objComm.CursorType = adOpenDynamic
> objComm.ActiveConnection = db
> objComm.CommandText = sql
> objComm.CommandType = adCmdText
> Set rs = objComm.Execute
> Set objComm = Nothing
>
> The ObjComm.CursorType causes this error: Object doesn't support this
> property or method: 'CursorType'
>
> Any ideas how to get around this? If I don't set a cursor type it works,
> but when I try to move backwards through the recordset, I get an error (I
> think it defaults to adOpenForwardOnly). I am also concerned about
> locking in case I want to use this methodology for adds and updates.
>
> Thanks,
>
> Tom
Message #4 by "Drew, Ron" <RDrew@B...> on Thu, 13 Sep 2001 16:35:49 -0400
|
|
I dont think the adobd.command uses cursortype. At least I have never used
it. I think cursortype is only for recordsets.
Take a look at this link ...
http://www.devguru.com/technologies/ado/quickref/command.html
-----Original Message-----
From: Tom Garrison [mailto:tom.garrison@e...]
Sent: Thursday, September 13, 2001 5:08 PM
To: ASP Databases
Subject: [asp_databases] Question Adding Cursor Types and Locks using
ADODB.Command
I am not sure how to do this and can not find the answer in any books. I
know how to set them using ADODB.Recordset (rs.Open sql, db,
adOpenForwardOnly, adLockReadOnly, adCmdText). However, when I try to set
them using ADODB.Command using the following syntax I get an error:
set objComm = Server.CreateObject ("ADODB.Command")
objComm.CursorType = adOpenDynamic
objComm.ActiveConnection = db
objComm.CommandText = sql
objComm.CommandType = adCmdText
Set rs = objComm.Execute
Set objComm = Nothing
The ObjComm.CursorType causes this error: Object doesn't support this
property or method: 'CursorType'
Any ideas how to get around this? If I don't set a cursor type it works,
but when I try to move backwards through the recordset, I get an error (I
think it defaults to adOpenForwardOnly). I am also concerned about
locking in case I want to use this methodology for adds and updates.
Thanks,
Tom
Message #5 by "Garrison, Tom" <tom.garrison@e...> on Thu, 13 Sep 2001 16:26:50 -0500
|
|
Could you please provide an example of this?
Tom
-----Original Message-----
From: Tomm Matthis [mailto:matthis@b...]
Sent: Thursday, September 13, 2001 3:40 PM
To: ASP Databases
Subject: [asp_databases] RE: Question Adding Cursor Types and Locks
using ADODB.Command
Set the type in the connection object, not the command object.
-- Tomm
> -----Original Message-----
> From: Tom Garrison [mailto:tom.garrison@e...]
> Sent: Thursday, September 13, 2001 9:08 PM
> To: ASP Databases
> Subject: [asp_databases] Question Adding Cursor Types and Locks using
> ADODB.Command
>
>
> I am not sure how to do this and can not find the answer in any books. I
> know how to set them using ADODB.Recordset (rs.Open sql, db,
> adOpenForwardOnly, adLockReadOnly, adCmdText). However, when I
> try to set
> them using ADODB.Command using the following syntax I get an error:
>
> set objComm = Server.CreateObject ("ADODB.Command")
> objComm.CursorType = adOpenDynamic
> objComm.ActiveConnection = db
> objComm.CommandText = sql
> objComm.CommandType = adCmdText
> Set rs = objComm.Execute
> Set objComm = Nothing
>
> The ObjComm.CursorType causes this error: Object doesn't support this
> property or method: 'CursorType'
>
> Any ideas how to get around this? If I don't set a cursor type it works,
> but when I try to move backwards through the recordset, I get an error (I
> think it defaults to adOpenForwardOnly). I am also concerned about
> locking in case I want to use this methodology for adds and updates.
>
> Thanks,
>
> Tom
Message #6 by David Cameron <dcameron@i...> on Fri, 14 Sep 2001 11:12:05 +1000
|
|
The error says it all. CursorType is not a property of the command object.
regards
David Cameron
nOw.b2b
dcameron@i...
-----Original Message-----
From: Chris Zuniga [mailto:Chris.Zuniga@g...]
Sent: Friday, 14 September 2001 6:30 AM
To: ASP Databases
Subject: [asp_databases] RE: Question Adding Cursor Types and Locks
using ADODB.Command
Right. I've even tried the adOpenStatic CursorType, and I still only get
"-1". Sorry I can't help you more.
CZ
-----Original Message-----
From: Tom Garrison [mailto:tom.garrison@e...]
Sent: Thursday, September 13, 2001 4:08 PM
To: ASP Databases
Subject: [asp_databases] Question Adding Cursor Types and Locks using
ADODB.Command
I am not sure how to do this and can not find the answer in any books. I
know how to set them using ADODB.Recordset (rs.Open sql, db,
adOpenForwardOnly, adLockReadOnly, adCmdText). However, when I try to set
them using ADODB.Command using the following syntax I get an error:
set objComm = Server.CreateObject ("ADODB.Command")
objComm.CursorType = adOpenDynamic
objComm.ActiveConnection = db
objComm.CommandText = sql
objComm.CommandType = adCmdText
Set rs = objComm.Execute
Set objComm = Nothing
The ObjComm.CursorType causes this error: Object doesn't support this
property or method: 'CursorType'
Any ideas how to get around this? If I don't set a cursor type it works,
but when I try to move backwards through the recordset, I get an error (I
think it defaults to adOpenForwardOnly). I am also concerned about
locking in case I want to use this methodology for adds and updates.
Thanks,
Tom
Message #7 by "Ken Schaefer" <ken@a...> on Fri, 14 Sep 2001 16:10:28 +1000
|
|
CursorType is *not* a property of the Command Object.
When you do this:
: Set rs = objComm.Execute
you are SETting rs to be whatever objComm.Execute returns (which is a
recordset). You are opening the recordset with the default locktype and
cursortype.
If you want to do updates and deletes, then use Sprocs to do this (or SQL
statements) - don't use Recordset objects...
Cheers
Ken
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
----- Original Message -----
From: "Tom Garrison" <tom.garrison@e...>
To: "ASP Databases" <asp_databases@p...>
Sent: Thursday, September 13, 2001 9:08 PM
Subject: [asp_databases] Question Adding Cursor Types and Locks using
ADODB.Command
: I am not sure how to do this and can not find the answer in any books. I
: know how to set them using ADODB.Recordset (rs.Open sql, db,
: adOpenForwardOnly, adLockReadOnly, adCmdText). However, when I try to set
: them using ADODB.Command using the following syntax I get an error:
:
: set objComm = Server.CreateObject ("ADODB.Command")
: objComm.CursorType = adOpenDynamic
: objComm.ActiveConnection = db
: objComm.CommandText = sql
: objComm.CommandType = adCmdText
: Set rs = objComm.Execute
: Set objComm = Nothing
:
: The ObjComm.CursorType causes this error: Object doesn't support this
: property or method: 'CursorType'
:
: Any ideas how to get around this? If I don't set a cursor type it works,
: but when I try to move backwards through the recordset, I get an error (I
: think it defaults to adOpenForwardOnly). I am also concerned about
: locking in case I want to use this methodology for adds and updates.
:
: Thanks,
:
: Tom
:
$subst('Email.Unsub')
Message #8 by "Tomm Matthis" <matthis@b...> on Fri, 14 Sep 2001 07:33:46 -0400
|
|
Here ya go:
'===========================================================================
=======
Dim objConn, objCmd, rsOrderDetail, intOrderNumber
Dim intFieldCount, intRecordCount
Set objConn = Server.CreateObject("ADODB.Connection")
Set objCmd = Server.CreateObject("ADODB.Command")
Set rsOrderDetail = Server.CreateObject("ADODB.RecordSet")
intOrderNumber = 10248
' Connection properties
objConn.CursorLocation = adUseClient
' NOTE: Put *your* connection string below.... <grin>
objConn.ConnectionString = Application("connNorthWind_ConnectionString")
objConn.Open
'Command properties
objCmd.ActiveConnection = objConn
objCmd.CommandText = "CustOrdersDetail"
objCmd.CommandType = adCmdStoredProc
objCmd.Parameters.Append
objCmd.CreateParameter("OrderID",adInteger,adParamInput)
objCmd.Parameters("OrderID").Value = intOrderNumber
'Recordset Properties
' NOTE: you could also set the cursor location here instead of on the
connection object
' but I find that I use the same location often, so to me, it's more
convienient
' to set it in the connection objects
rsOrderDetail.CursorType = adOpenStatic
rsOrderDetail.LockType = adLockReadOnly
'Everything all prepped... go
Set rsOrderDetail = objCmd.Execute
intRecordCount = rsOrderDetail.RecordCount
With Response
.Write "<TABLE Border=1 align=center>"
.Write "<Caption align=top><FONT COLOR=GREEN>Order #" & intOrderNumber & "
Details</FONT></Caption></TR>"
.Write "<Caption align=bottom><FONT COLOR=BLUE>" & intRecordCount & " rows
returned.</FONT></Caption></TR><TR bgcolor=silver>"
For each objField in rsOrderDetail.Fields
.Write "<TH>" & objField.Name & "</TH>"
Next
.Write "</TR><TR><TD>"
.Write
rsOrderDetail.GetString(adClipString,,"</TD><TD>","</TD></TR><TR><TD>")
.Write "</TR></TABLE>"
End With
'Clean up
rsOrderDetail.Close
objConn.Close
Set objField = Nothing
Set rsOrderDetail = Nothing
Set objCmd = Nothing
Set objConn = Nothing
'===========================================================================
=======
> -----Original Message-----
> From: Garrison, Tom [mailto:tom.garrison@e...]
> Sent: Thursday, September 13, 2001 5:27 PM
> To: ASP Databases
> Subject: [asp_databases] RE: Question Adding Cursor Types and Locks us
> ing ADODB.Command
>
>
> Could you please provide an example of this?
>
> Tom
>
>
> -----Original Message-----
> From: Tomm Matthis [mailto:matthis@b...]
> Sent: Thursday, September 13, 2001 3:40 PM
> To: ASP Databases
> Subject: [asp_databases] RE: Question Adding Cursor Types and Locks
> using ADODB.Command
>
>
> Set the type in the connection object, not the command object.
>
> -- Tomm
>
> > -----Original Message-----
> > From: Tom Garrison [mailto:tom.garrison@e...]
> > Sent: Thursday, September 13, 2001 9:08 PM
> > To: ASP Databases
> > Subject: [asp_databases] Question Adding Cursor Types and Locks using
> > ADODB.Command
> >
> >
> > I am not sure how to do this and can not find the answer in any
> books. I
> > know how to set them using ADODB.Recordset (rs.Open sql, db,
> > adOpenForwardOnly, adLockReadOnly, adCmdText). However, when I
> > try to set
> > them using ADODB.Command using the following syntax I get an error:
> >
> > set objComm = Server.CreateObject ("ADODB.Command")
> > objComm.CursorType = adOpenDynamic
> > objComm.ActiveConnection = db
> > objComm.CommandText = sql
> > objComm.CommandType = adCmdText
> > Set rs = objComm.Execute
> > Set objComm = Nothing
> >
> > The ObjComm.CursorType causes this error: Object doesn't support this
> > property or method: 'CursorType'
> >
> > Any ideas how to get around this? If I don't set a cursor type
> it works,
> > but when I try to move backwards through the recordset, I get
> an error (I
> > think it defaults to adOpenForwardOnly). I am also concerned about
> > locking in case I want to use this methodology for adds and updates.
> >
> > Thanks,
> >
> > Tom
|
|
 |