Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: Help with the recordset object


Message #1 by "Phil Perks" <philp@w...> on Mon, 24 Apr 2000 17:31:43
-----Original Message-----

From: Jason Lazaro [mailto:jlazaro@p...]

Sent: 24 April 2000 16:00

To: support@w...

Subject: Help with the recordset object

 

Can you please tell me how to use the rs.open recordset property with a 

command object that takes in parameters.

I need to the recorset to be dynamic so that I can move back and forth with 

it

I can not find an answer to this in your bood Active Server Pages 2.0.  Can 

you please help me.



SET DataCmd = Server.CreateObject("ADODB.COMMAND")

 Set DataCmd.ActiveConnection = Dataconn 

DataCmd.CommandType=adCMDStoredProc 

DataCmd.CommandText="sp_GetComp" 

DataCmdType = adCMDText 

 

Set param1 = DataCmd2.CreateParameter("BriefType",3,1) 

DataCmd2.Parameters.Append param1 

 

if STRCOMP (Request.QueryString("brief"),"")= 0 THEN 

    DataCmd("BriefType")=1 

else 

    DataCmd("BriefType")= Request.QueryString("brief") 

End if



????rs.Open 





Jason Lazaro

Message #2 by "Dave Sussman" <davids@i...> on Tue, 25 Apr 2000 09:25:32 +0100
This should do the trick.



rs.Open DataCmd, , adOpenDynamic, adLockReadOnly



You don't need to specify the connection details, since they are already in

the command.



Dave





"Phil Perks" <philp@w...> wrote in message news:2078@a..._databases...

>

> -----Original Message-----

> From: Jason Lazaro [mailto:jlazaro@p...]

> Sent: 24 April 2000 16:00

> To: support@w...

> Subject: Help with the recordset object

>

> Can you please tell me how to use the rs.open recordset property with a

> command object that takes in parameters.

> I need to the recorset to be dynamic so that I can move back and forth

with

> it

> I can not find an answer to this in your bood Active Server Pages 2.0.

Can

> you please help me.

>

> SET DataCmd = Server.CreateObject("ADODB.COMMAND")

>  Set DataCmd.ActiveConnection = Dataconn

> DataCmd.CommandType=adCMDStoredProc

> DataCmd.CommandText="sp_GetComp"

> DataCmdType = adCMDText

>

> Set param1 = DataCmd2.CreateParameter("BriefType",3,1)

> DataCmd2.Parameters.Append param1

>

> if STRCOMP (Request.QueryString("brief"),"")= 0 THEN

>     DataCmd("BriefType")=1

> else

>     DataCmd("BriefType")= Request.QueryString("brief")

> End if

>

> ????rs.Open

>

>

> Jason Lazaro

>

>





Message #3 by "Piotrowski, Sebastian" <Sebastian.Piotrowski@a...> on Tue, 25 Apr 2000 18:52:08 +1000
if using the command object with the recordset object you must use the

connection object

Try something like this 



======================================================

'Create Connection Object

Set objConn = Server.Createobject("ADODB.Connection")

objConn.Open "DSN=Mydb"



'Do some error checking 



'Create Command Object

Set objCmd = Server.CreateObject("ADODB.Command")



'Do some error checking



'Set command object properties

Set objCmd.ActiveConnection = objConn

objCmd.CommandText = "qGetAllLastNames"

objCmd.CommandType = adCmdStoredProcedure



'Create RecordSet

Set objRS = Server.CreateObject("ADODB.RecordSet")

objRs.Open objCmd



=======================================================



hope this helps ;)



Sebastian

-----Original Message-----

From: Phil Perks [mailto:philp@w...]

Sent: Tuesday, 25 April 2000 12:45

To: ASP Databases

Subject: [asp_databases] Help with the recordset object





-----Original Message-----

From: Jason Lazaro [mailto:jlazaro@p...]

Sent: 24 April 2000 16:00

To: support@w...

Subject: Help with the recordset object

 

Can you please tell me how to use the rs.open recordset property with a 

command object that takes in parameters.

I need to the recorset to be dynamic so that I can move back and forth with 

it

I can not find an answer to this in your bood Active Server Pages 2.0.  Can 

you please help me.



SET DataCmd = Server.CreateObject("ADODB.COMMAND")

 Set DataCmd.ActiveConnection = Dataconn 

DataCmd.CommandType=adCMDStoredProc 

DataCmd.CommandText="sp_GetComp" 

DataCmdType = adCMDText 

 

Set param1 = DataCmd2.CreateParameter("BriefType",3,1) 

DataCmd2.Parameters.Append param1 

 

if STRCOMP (Request.QueryString("brief"),"")= 0 THEN 

    DataCmd("BriefType")=1 

else 

    DataCmd("BriefType")= Request.QueryString("brief") 

End if



????rs.Open 





Jason Lazaro



---

You are currently subscribed to asp_databases 



  Return to Index