[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

VFP Access Data from Cursor Alias

Posted on 2012-09-11
3
Medium Priority
?
861 Views
Last Modified: 2012-09-12
I'm trying to figure out how to access data from a cursor alias.
Normally I do this:
lnResult=SQLEXEC(pnConnection,lcQuery,'cCursor')

Open in new window

and the data is at cursorname.fieldname

I am trying to do this:

lcCursor = "cCursor"
lnResult=SQLEXEC(pnConnection,lcQuery,lcCursor)

Open in new window


and ALLTRIM(cCursor.fieldname) doesn't work.

maybe it's cause I've been up for nearly 30 hours now that it's not working??
0
Comment
Question by:formadmirer
3 Comments
 
LVL 30

Assisted Solution

by:Olaf Doschke
Olaf Doschke earned 1000 total points
ID: 38389780
Changing from string literal to a variable containing the cursor name can't be the problem. Simply check lnResult and used(lcCursor) in the first place. If lnResult<0, check for errors. If lnResult=0 check your default setting for asynchronous execution of SQLEXEC.
If lnResult>0 and Used(lcCursor) is .f., do you really do a SELECT?  Inserts and Updates don't create a result set. Calling stored procs it depends on the return type.

Bye, Olaf.
0
 
LVL 43

Accepted Solution

by:
pcelba earned 1000 total points
ID: 38390015
ALLTRIM(cCursor.fieldname)  must work but
ALLTRIM(lcCursor.fieldname)  cannot work and you have to use
ALLTRIM(EVALUATE(lcCursor + ".fieldname"))

or better

SELECT (lcCUrsor)
ALLTRIM(fieldname)
0
 

Author Comment

by:formadmirer
ID: 38393479
Thanks for the help. I just stuck with doing things the way I have done before and works.
Less work for me too ;)
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Visual FoxPro (short VFP) is a programming language with it’s own IDE and database, ranking somewhat between Access and VB.NET + SQL Server (Express). Product Description: http://msdn.microsoft.com/en-us/vfoxpro/default.aspx (http://msd…
LinkedIn blogging is great for networking, building up an audience, and expanding your influence as well. However, if you want to achieve these results, you need to work really hard to make your post worth liking and sharing. Here are 4 tips that ca…
Integration Management Part 2
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

825 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question