| Register | FAQ | Calendar | Search | Today's Posts | Mark Forums Read |
|
#1
| |||
| |||
| I am having trouble iterating through the set of recordsets returned from a query that returns multiple tables. I am using the DB Tools Fetch Next Recordset.vi in a loop to iterate through recordsets until they have all been processed. One problem I have is that there is no indication that you have iterated past the end of recordsets. DB Tools Fetch Next Recordset does not produce an eof type indication like you get when iterating through records in a recordset. My code is attached: 1. Open a database and execute a query that returns more than 1 table (SELECT * FROM tblA SELECT * FROM tblB) 2. Fetch the current recorset data and store in array. 3. Use DB Tools Fetch Next Recordset to move to the next recordset. Question: What is the stop condition to test for? Errors propogate through to the close vi which reports: Error 97 occurred at Rec Get Recordset Properties (R).vi->Rec Fetch Recordset Data (R).vi->Untitled 1 Possible reason(s):Unknown System Error in Rec Get Recordset Properties (R).vi->Rec Fetch Recordset Data (R).vi->Untitled 1 Any help or example for navigating recordsets? Thanks, -cb Iterate recordsets3.png: http://forums.ni.com/attachments/ni/...4030/1/Iterate recordsets3.png |
|
#2
| |||
| |||
| Hi, I believe you can still use the "DB Tools Get Properties" Vi to return either the number of recordsets, or an end of file condition (meaning you have reached the end of your recordsets.) This VI returns different parameters in its output cluster depending on the reference passed to it. Passing it a single recordset refrence, or a group of recordsets, should return the same data elements, and you can poll these elements in a loop to determin the stop condition.I would still suggest experimenting with this VI, as I have not implemented it myself, and so I dont know exactly what you will get in the properties cluster. |
![]() |
| Thread Tools | |
| Display Modes | |
In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.