Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: Record Set Problems (Exception has occured)


Message #1 by "JeC" <jdcollis@o...> on Wed, 19 Dec 2001 10:29:40
Can you put 2 Recordsets within each other?



I ask this because I am making a small forum, in the display page it uses 

information from 3 tables, the table header, replies, and login. In the 

header and replies tables each message contains a username, the third 

table uses this each time a message is written to display the number of 

posts of the user.



I have created two recordsets for this. 1st one...



Set ObjCommand = server.CreateObject("ADODB.command")

ObjCommand.ActiveConnection = strConnect

ObjCommand.CommandType = adCmdText

ObjCommand.CommandText = SrchStr



This searches for the thread in the tables, and works well by it's self.



2nd...

Dim objRS2

Set objRS2 = server.CreateObject("ADODB.Recordset")

objRS2.open "login", strConnect, adOpenDynamic, adLockOptimistic, 

adCmdTable



This opens the login table.Then each time it runs a reply or the main 

header it earchers



objRS2.Find  "un = '" & objrS("user") & "'"



It uses the current "user" fiield from the first record set to find the 

right record in the login table.



All this works up to here... I can have all this in, and the page is 

displayed properly. It's only when I got to write something to the page 

from the second recordset (the posts for the user) that the error comes up.



Response.write objRS2("posts") <-- This writes the number of posts after 

its searched.



AND heres the error I  cannot get past.



Error Type:

(0x80020009)

Exception occurred. 





I'm stumped. Can someone solve this for me? 

Do I need to supply any other details?



Thanks a lot



-JeC-
Message #2 by "Ken Schaefer" <ken@a...> on Wed, 19 Dec 2001 22:03:28 +1100
Why don't you do a JOIN so as to avoid having so many recordsets, and so

much recordset scrolling?



WRT the error you are getting, are you using SQL Server Text (or Access

Memo) for the field in question?



Cheers

Ken



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

From: "JeC" <jdcollis@o...>

Subject: [asp_databases] Record Set Problems (Exception has occured)





: Can you put 2 Recordsets within each other?

:

: I ask this because I am making a small forum, in the display page it uses

: information from 3 tables, the table header, replies, and login. In the

: header and replies tables each message contains a username, the third

: table uses this each time a message is written to display the number of

: posts of the user.

:

: I have created two recordsets for this. 1st one...

:

: Set ObjCommand = server.CreateObject("ADODB.command")

: ObjCommand.ActiveConnection = strConnect

: ObjCommand.CommandType = adCmdText

: ObjCommand.CommandText = SrchStr

:

: This searches for the thread in the tables, and works well by it's self.

:

: 2nd...

: Dim objRS2

: Set objRS2 = server.CreateObject("ADODB.Recordset")

: objRS2.open "login", strConnect, adOpenDynamic, adLockOptimistic,

: adCmdTable

:

: This opens the login table.Then each time it runs a reply or the main

: header it earchers

:

: objRS2.Find  "un = '" & objrS("user") & "'"

:

: It uses the current "user" fiield from the first record set to find the

: right record in the login table.

:

: All this works up to here... I can have all this in, and the page is

: displayed properly. It's only when I got to write something to the page

: from the second recordset (the posts for the user) that the error comes

up.

:

: Response.write objRS2("posts") <-- This writes the number of posts after

: its searched.

:

: AND heres the error I  cannot get past.

:

: Error Type:

: (0x80020009)

: Exception occurred.

:

:

: I'm stumped. Can someone solve this for me?

: Do I need to supply any other details?



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~




  Return to Index