Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ADO and unknown number of recordsets
Message
 
 
To
14/03/2004 22:57:39
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Miscellaneous
Thread ID:
00886192
Message ID:
00886266
Views:
11
Jeannie,

You can use NextRecordset() method of RS (recordset) to get next available RS. You've to store RS reference somewhere if you want to process them later. Below you'll find sample code that demondtrates how it can be done.
...
oCon.CursorLocation = 3   && Client side RS so Record count is available
oCon.Open

oCommand = CREATEOBJECT("adodb.command")	
oCommand.ActiveConnection = oCon
oCommand.CommandType = adCmdStoredProc
oCommand.CommandText = "test_mrs"
oRs = oCommand.Execute()
DIMENSION laRS[1]
lnRScount = 0
DO WHILE NOT ISNULL(oRS)
  lnRScount = lnRScount + 1
  DIMENSION laRS[lnRScount]
  * Store RS for future use
  laRS[lnRScount] = oRS
  ? oRS.RecordCount       && Record count
  oRS = oRS.NextRecordset()
ENDDO
>I'm need to some expertise in the area an unknown number of ADO recordsets returned from a call to an SP.
>
>How can I check for the validity of the last recordset without bombing out? Should I loop through the recordsets to determine the number of recordsets returned first and use the count? If so, how do I best handle this? Each recordset does contain a query name that tells us what the recordset will contain but the number of recordsets can and does vary.
>
>We have a mix of FPW 2.6 and VFP applications that need to do this check.
>
>Advise, please? Thanks in advance~
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform