RE: Cursor Adapter in DE Question

Author: Dave Crozier

Posted: 2011-10-12 at 03:17:27

Rafael,

Well that is the way I normally do things i.e entirely in code and using SPT but I thought I'd just take a dip in to see if it would save time.... Seemingly not, so I'll just recode everything using my normal Data Access Components...

Thanks for the reply. As they say, if we don't try these new things we'll never know how good or bad they are.

Dave

-----Original Message-----

From: profox-bounces@leafe.com [mailto:profox-bounces@leafe.com] On Behalf Of Rafael Copquin

Sent: 11 October 2011 17:07

To: profox@leafe.com

Subject: Re: Cursor Adapter in DE Question

It is a better way of doing things, to do your CA's in code and not in

the DE. You have greater control, especially if your select statement

involves more than one table. If you use the DE CA you would have to

change the select statement manually, because the wizard can only create

a select of just one table efficiently ( I mean, adding the joins properly)

Another thing you might consider, is not to use relations at all but sql

select statements to get the child table, based on the primary key of

the father table that has a correspondence in the child table as a

foreign key. IOW, get the primary key of the record in the father table,

then issue a select statement to get the child records based on that key

which should be the foreign key in the child.

ie nPK = fathertable.pkfield

select * from childtable where foreingkeyfield = nPK

So every time you refresh your CA (you can use requery(), just like a

view ), get the PK of the record you just obtained, and use a select

statement as above to get your child records.

BTW, your child could be another CA or just a non-CA cursor, as you

explained

The other thing that comes to mind is that the only way I find CA's

benefitial in a situation as the one you describe is when you need to

update the underlying table, otherwise, simple SPT statements would do

just fine.

Rafael Copquin

El 11/10/2011 12:41, Dave Crozier escribió:

> Not having used cursor adapters very much and wanting to try them as a short cut to make the conversion of a suite of programs into "Client server" I have the following Question.

>

> I have a parent table which I can pick up in the cursoradapter modifying the "SelectCmd property and then issuing a CursorFill method no problem, the parent table refreshes itself OK and reflecs this in the form.

>

> However, when I add a child table that is NOT a cursor adapter but a VFP table and then set up the relationship in the DE as you would with standard VFP tables using a dragged link between the parent and child, then when I "Refill" the parent table, the child doesn't reposition itself as per the relationship. Its just as though the relationship needs to be refreshed, but you can't refresh a relationship!!!

>

>

> Any Ideas.... this is driving me mad and I wish I'd stayed with SPT throughout, but using adapters would save so much recoding...

>

>

> Dave C

>

>

[excessive quoting removed by server]

_______________________________________________

Post Messages to: ProFox@leafe.com

Subscription Maintenance: http://leafe.com/mailman/listinfo/profox

OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech

Searchable Archive: http://leafe.com/archives/search/profox

This message: http://leafe.com/archives/byMID/profox/BD031ECABF2B60499200AAB3DBB4A9997366B55E@EX-A-FPL.FPL.LOCAL

** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

©2011 Dave Crozier