Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
CursorAdapter Update Puzzle
Message
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
CursorAdapter Update Puzzle
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Vista
Network:
Windows 2008 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01346439
Message ID:
01346439
Views:
70
Hello!

I've been trying to get a CursorAdapter class working for a child table in a grid, and I've had some success with it. Here's the code I use to instantiate the CA and generate the cursor that the grid uses as a datasource:

loca1 = CREATEOBJECT("CursorAdapter")
loca1.DataSourceType = "Native"
loca1.SelectCmd = "SELECT Leaseclause.* FROM bud!leaseclause WHERE Leaseclause.clink = lease.lease AND Leaseclause.ndisplayorder = 9 ORDER BY Leaseclause.ndisplayorder"
loca1.alias = "v_leaseclause"
loca1.tables = "leaseclause"
loca1.keyfieldlist = "cid"
loca1.updatablefieldlist = "ctext"
loca1.updatenamelist = "ctext leaseclause.ctext"
loca1.updatecmd = "update leaseclause set ctext = v_leaseclause.ctext where leaseclause.cid = v_leaseclause.cid"
loca1.CursorFill()

In the business object's REFRESH() method, I've put in a loca1.CursorRefresh() call to refresh the cursor records when the user moves off of the parent table record.

Everything appears to be working correctly with the grid in that it shows the detail records and updates the child table whenever changes are made on the grid. I've verified that the field values are being updated in the base table in a separate VFP session after the user moves off of the record.

HOWEVER, when I add an index on the child table for the key field (CID) to improve the update speed, something weird happens. Now, when the user makes a change to the child cursor in the grid and moves off of the parent record, the child table changes aren't being sent to the base table like before. The only way to get the child table changes to stick is to close and re-open the form.

I confirmed that SET("SQLBUFFERING") is set to "OFF" in the form, and have made NO changes to the form code when it was working. The only difference is the existence of the CID index in the child table.

Can anyone tell me what CA property or environmental setting I need to adjust to get the CA update statement working with the table index?

Thanks,

Ben Holton
Reply
Map
View

Click here to load this message in the networking platform