Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I Determine if the Cursor is empty? 1

Status
Not open for further replies.

PatMcLaughlin

Programmer
Dec 10, 2010
97
US
In .Net (which I am most familiar) I would simply say

nVariable = nDataSet.Tables("Table").rows.count

then ask if the nVariable is greater than 1.

I am not seeing how it is done in Foxprow9.

(Hot project or I would hunt til I found this)
 
Code:
? RECCOUNT("CursorName")

Borislav Borissov
VFP9 SP2, SQL Server 2000,2005 & 2008.
 
Notice: RecCount() also includes the count of records marked deleted. But that won't matter for cursors, where you typically want to know how much records were fetched into it. And as you don't get deleted rows into a query result, RecCount() gives the reccount.

Another helpful system variable is _TALLY, giving the count of processed rows, not only for SELECT queries, but also after UPDATES, where it's more useful than reccount() of the updated table, of course.

Another general recommendation: Search cAlias in the help and you will get a list of the functions related to cursors with a parameter for a cursor alias. In VFP unlike .NET and other modern oop languages not everything is an object and so unfortunately not everything is discoverable using intellisense.

With the Sedna addons you find at codeplex embedded into the VFPX meta project of many VP9 extensions, you get a simple simulation of the My namespace, see [URL unfurl="true"]http://www.code-magazine.com/article.aspx?quickid=0703082[/url]

That doesn't help with reccount, but goes into the direction of a more throughly support of discoverability of functions, commands and classes.

On the other side VFP is clear and neat and you find everything in the help's reference section interconnected with "See also" notes at the end of every help topic.

Here's the entry point:
Bye, Olaf.
 
i also do this:
depending on your set deleted.

? eof("myCursor") && .t. if no records, .f. if there is 1 or more record.

Ali Koumaiha
TeknoSoft Inc.
Michigan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top