Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_ado_rds thread: How does the Recordset work???


Message #1 by "tinweimin" <steven_tin@e...> on Wed, 2 May 2001 11:00:18
 if i design the code 1 and 2~

question 1:

 I will Set rs   = Server.CreateObject("ADODB.Recordset")....

 10 times.

  

  how doese the Set rs   = Server.CreateObject("ADODB.Recordset") work??

  allocation a new memory for rs each time??

  And i do not close the rs and reopen the rs......it's good???

  it will to reduce the performance ???



question 2:

  how to find the Recordset document....

  Because i need to know more about recordset ...

  like how to allocation memory while {Set rs   = Server.CreateObject   

("ADODB.Recordset") }.....how to release the memory while rs.close.....



Thanks a lot

   

1.

<%

  set conn = server.CreateObject ("ADODB.Connection")

  conn.Open "DSN=ADO;uid=sa;pwd=;"

  sql = ""

  sql = sql & "select * from BasicInfo"

  

  for i = 0 to 10

       Set rs   = Server.CreateObject("ADODB.Recordset")

       rs.open sql,conn,3,3

  next

%>



Another code....

   2 is batter than a???? why??

2.

<%

  set conn = server.CreateObject ("ADODB.Connection")

  conn.Open "DSN=ADO;uid=sa;pwd=;"

  Set rs   = Server.CreateObject("ADODB.Recordset")

  

  sql = ""

  sql = sql & "select * from BasicInfo"

  

  for i = 0 to 10

	 rs.open sql,conn,3,3

	 rs.close

  next

%>
Message #2 by Josh King <JoshK@g...> on Wed, 2 May 2001 08:40:33 -0500
Why are you creating 10 of the same recordsets?  If you want to duplicate

the recordset you could use the Clone method.  Example:

	

Dim rs(9), x, iRowCounter



X = 1



Set rs(0) = Server.CreateObject("ADODB.Recordset")



For iRowCounter=1 To 9



Set rs(x) = rs(0).Clone



X = X + 1



Next



Then you have 10 different recordsets you can reference by number from the

rs(x) array.  The way you were doing it is creating the same recordset

object 10 times which there's really no point in doing.  



Question #2-  Not sure?





Josh King



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

From: tinweimin [mailto:steven_tin@e...]

Sent: Wednesday, May 02, 2001 6:00 AM

To: ASP_ADO_RDS

Subject: [asp_ado_rds] How does the Recordset work???



 if i design the code 1 and 2~

question 1:

 I will Set rs   = Server.CreateObject("ADODB.Recordset")....

 10 times.

 

  how doese the Set rs   = Server.CreateObject("ADODB.Recordset") work??

  allocation a new memory for rs each time??

  And i do not close the rs and reopen the rs......it's good???

  it will to reduce the performance ???



question 2:

  how to find the Recordset document....

  Because i need to know more about recordset ...

  like how to allocation memory while {Set rs   = Server.CreateObject  

("ADODB.Recordset") }.....how to release the memory while rs.close.....



Thanks a lot

  

1.

<%

  set conn = server.CreateObject ("ADODB.Connection")

  conn.Open "DSN=ADO;uid=sa;pwd=;"

  sql = ""

  sql = sql & "select * from BasicInfo"

 

  for i = 0 to 10

       Set rs   = Server.CreateObject("ADODB.Recordset")

       rs.open sql,conn,3,3

  next

%>



Another code....

   2 is batter than a???? why??

2.

<%

  set conn = server.CreateObject ("ADODB.Connection")

  conn.Open "DSN=ADO;uid=sa;pwd=;"

  Set rs   = Server.CreateObject("ADODB.Recordset")

 

  sql = ""

  sql = sql & "select * from BasicInfo"

 

  for i = 0 to 10

         rs.open sql,conn,3,3

         rs.close

  next

%>

---

http://www.asptoday.com - the leading site for timely,

in-depth information for ASP developers everywhere.




Message #3 by "tinweimin" <steven_tin@e...> on Wed, 2 May 2001 16:19:48
i mean that ...

 maybe i'll have 10 times sql="select A from...

 example:

  sql(0) = "select a from....."

  sql(1) = "select b from ...."

 

 sometime i do not know the user which column he how to search...

 so that i need to dynamic create some sql language for user...

 like:

    sql(0) = "select a from....."

    sql(1) = "select b from ...."

 

<%

  set conn = server.CreateObject ("ADODB.Connection")

  conn.Open "DSN=ADO;uid=sa;pwd=;"

  sql(0) = "select a from....."

  sql(1) = "select b from ...."

  ......





  for i = 0 to 10

       Set rs   = Server.CreateObject("ADODB.Recordset")

       rs.open sql(i),conn,3,3

  next

%>





Message #4 by "Branimir Giurov" <branimir@n...> on Fri, 11 May 2001 15:40:15
on the second question :



after you finish with the recordset, i.e  after

<%



dim rs

set re=Server.CreateObject("ADODB.Recordset")

..

..

rs.Close

set rs=nothing



%>

that's all





>  if i design the code 1 and 2~

> question 1:

>  I will Set rs   = Server.CreateObject("ADODB.Recordset")....

>  10 times.

>   

>   how doese the Set rs   = Server.CreateObject("ADODB.Recordset") work??

>   allocation a new memory for rs each time??

>   And i do not close the rs and reopen the rs......it's good???

>   it will to reduce the performance ???

> 

> question 2:

>   how to find the Recordset document....

>   Because i need to know more about recordset ...

>   like how to allocation memory while {Set rs   = Server.CreateObject   

> ("ADODB.Recordset") }.....how to release the memory while rs.close.....

> 

> Thanks a lot

>    

> 1.

> <%

>   set conn = server.CreateObject ("ADODB.Connection")

>   conn.Open "DSN=ADO;uid=sa;pwd=;"

>   sql = ""

>   sql = sql & "select * from BasicInfo"

>   

>   for i = 0 to 10

>        Set rs   = Server.CreateObject("ADODB.Recordset")

>        rs.open sql,conn,3,3

>   next

> %>

> 

> Another code....

>    2 is batter than a???? why??

> 2.

> <%

>   set conn = server.CreateObject ("ADODB.Connection")

>   conn.Open "DSN=ADO;uid=sa;pwd=;"

>   Set rs   = Server.CreateObject("ADODB.Recordset")

>   

>   sql = ""

>   sql = sql & "select * from BasicInfo"

>   

>   for i = 0 to 10

> 	 rs.open sql,conn,3,3

> 	 rs.close

>   next


  Return to Index