Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: If solved let me know..Need help with multiple recordsets


Message #1 by Vineet Pruthi <vineetpruthi@y...> on Fri, 25 Oct 2002 00:47:32 -0700 (PDT)
Hi..
you was facing problem in displaying data from 2
recordsets. I am also facing same problem.If u have
solved that problem than please let me know the
solution so that i can also solve my problem..
Thanks & Regards,
-Vineet Pruthi.


--- chrscote@9... wrote:
> I am having a few problems with displaying some data
> from my database.  I 
> have 2 separate sections in one page which display
> data from 2 different 
> tables.  I have tried setting up 2 recordsets, one
> for each query I need 
> to retrieve.  However, after getting the data from
> the first table fine, I 
> always get an error saying "Object does not support
> this property or 
> method: 'Open'"  I have listed below the code I am
> using for this page.  I 
> hope someone can find what I'm doing wrong, 'cause I
> can't seem to find it.
> 
> 
> <%     dim conn
>        set conn 
> Server.CreateObject("ADODB.Connection")
>        conn.Open "DSN=Baseball"
>        SQLStr = "SELECT * FROM BattersTotals;"
>        dim objRS
>        set objRS 
> Server.CreateObject("ADODB.Recordset")
>        objRS.open SQLStr, conn
>        
>        dim AB, Hits, Dbl, Triple, HR, Walk, HP, avg,
> slg, obp
>        Do while not objRS.EOF
> 	AB = objRS("AB")
> 	Hits = objRS("H")
> 	Dbl = objRS("2B")
> 	Triple = objRS("3B")
> 	HR = objRS("HR")
> 	Walk = objRS("BB")
> 	HP = objRS("HP")
> 									
> 	if (AB > 0) Then
> 		avg = FormatNumber(Round(Hits/AB,3),3)
> 		slg = FormatNumber(Round(((4*HR) + (3*Triple) +
> (2*Dbl) + 
> (Hits - (Dbl+Triple+HR)))/AB,3),3)
> 		obp = FormatNumber(Round((Hits + Walk + HP) /
> AB,3),3)
> 	else 
> 		avg = "0.00"
> 		slg = "0.00"
> 		obp = "0.00"
> 	end if
> %>
> <tr>
>    <td><%=objRS("H")%></td><td>......</td>
> </tr>
> <% objRS.moveNext
>    Loop
>    objRS.close
>    set objRS = nothing
> 
>    objRS2 = Server.CreateObject("ADODB.Recordset")
>    SQLStr = "SELECT * FROM PitchersTotals;"
>    objRS2.open SQLStr, conn         //Error occurs
> here
>   
>    Do while not objRS2.EOF
> ...
> ...
> ...
>    objRS2.moveNext
>    Loop
> 
>    objRS2.close
>    set objRS2 = nothing
> %>
> 
> Thank you in advance for your help.
> Chris
> 
> </tr>


__________________________________________________
Do you Yahoo!?
Y! Web Hosting - Let the expert host your web site
http://webhosting.yahoo.com/
Message #2 by "Jonas Skafte Jensen" <jonax@t...> on Tue, 29 Oct 2002 11:23:24
I think the problem in the shown example is the line:
objRS2 = Server.CreateObject("ADODB.Recordset")

it should read:
SET objRS2 = Server.CreateObject("ADODB.Recordset")

> Hi..
you was facing problem in displaying data from 2
recordsets. I am also facing same problem.If u have
solved that problem than please let me know the
solution so that i can also solve my problem..
Thanks & Regards,
-Vineet Pruthi.


--- chrscote@9... wrote:
> I am having a few problems with displaying some data
> from my database.  I 
> have 2 separate sections in one page which display
> data from 2 different 
> tables.  I have tried setting up 2 recordsets, one
> for each query I need 
> to retrieve.  However, after getting the data from
> the first table fine, I 
> always get an error saying "Object does not support
> this property or 
> method: 'Open'"  I have listed below the code I am
> using for this page.  I 
> hope someone can find what I'm doing wrong, 'cause I
> can't seem to find it.
> 
> 
> <%     dim conn
>        set conn 
> Server.CreateObject("ADODB.Connection")
>        conn.Open "DSN=Baseball"
>        SQLStr = "SELECT * FROM BattersTotals;"
>        dim objRS
>        set objRS 
> Server.CreateObject("ADODB.Recordset")
>        objRS.open SQLStr, conn
>        
>        dim AB, Hits, Dbl, Triple, HR, Walk, HP, avg,
> slg, obp
>        Do while not objRS.EOF
> 	AB = objRS("AB")
> 	Hits = objRS("H")
> 	Dbl = objRS("2B")
> 	Triple = objRS("3B")
> 	HR = objRS("HR")
> 	Walk = objRS("BB")
> 	HP = objRS("HP")
> 									
> 	if (AB > 0) Then
> 		avg = FormatNumber(Round(Hits/AB,3),3)
> 		slg = FormatNumber(Round(((4*HR) + (3*Triple) +
> (2*Dbl) + 
> (Hits - (Dbl+Triple+HR)))/AB,3),3)
> 		obp = FormatNumber(Round((Hits + Walk + HP) /
> AB,3),3)
> 	else 
> 		avg = "0.00"
> 		slg = "0.00"
> 		obp = "0.00"
> 	end if
> %>
> <tr>
>    <td><%=objRS("H")%></td><td>......</td>
> </tr>
> <% objRS.moveNext
>    Loop
>    objRS.close
>    set objRS = nothing
> 
>    objRS2 = Server.CreateObject("ADODB.Recordset")
>    SQLStr = "SELECT * FROM PitchersTotals;"
>    objRS2.open SQLStr, conn         //Error occurs
> here
>   
>    Do while not objRS2.EOF
> ...
> ...
> ...
>    objRS2.moveNext
>    Loop
> 
>    objRS2.close
>    set objRS2 = nothing
> %>
> 
> Thank you in advance for your help.
> Chris
> 
> </tr>


__________________________________________________
Do you Yahoo!?
Y! Web Hosting - Let the expert host your web site
http://webhosting.yahoo.com/

  Return to Index