We have just recently moved some free tables into a DBC to take advantage of the triggers to write data into a SQL-server table. The triggers themselves are working fine, however the issue we have come up against is that quite often we are making updates using a Set relation to.. and Scan .. replace Endscan routine.
The set relation works fine for just browsing the table but once we start updating it doesn’t seem to move the record pointer. Here is an example.
TableA= Table in DBC with Trigger to update SQL.
Custid c(10), Cust_name c(30)
Index on custid Tag Custid
‘123’, ‘Customer 1 ‘
‘124’, ‘Customer 2 ‘
‘125’, ‘Customer 3 ‘
‘126’, ‘Customer 4 ‘
TableB= free table to update names in tableA
Custid c(10), Cust_name c(30)
‘123’, ‘Jon Doe ‘
‘124’, ‘Gene Erik ‘
‘125’, ‘Fred FlintStone‘
‘126’, ‘Barney Rubble‘
Select TableB
Set relation to Custid into TableA
Scan
Replace Next 1 TableA.Cust_name with tableB.Cust_name
? Tablea.custid, TableA.Cust_name
endscan
Result:
123 Jon Doe
123 Gene Erik
123 Fred FlintStone
123 Barney Rubble
~
If I remove the trigger, the replace works fine and everything updates as it should- except of course the SQL table which was the point of the trigger in the first place. I’ve tried this with both VFP6 and 9 so it doesn’t appear to be a version issue.
Has anyone else ever come across this situation? And if so, what can we do to solve this.
Thanks
Hal
The set relation works fine for just browsing the table but once we start updating it doesn’t seem to move the record pointer. Here is an example.
TableA= Table in DBC with Trigger to update SQL.
Custid c(10), Cust_name c(30)
Index on custid Tag Custid
‘123’, ‘Customer 1 ‘
‘124’, ‘Customer 2 ‘
‘125’, ‘Customer 3 ‘
‘126’, ‘Customer 4 ‘
TableB= free table to update names in tableA
Custid c(10), Cust_name c(30)
‘123’, ‘Jon Doe ‘
‘124’, ‘Gene Erik ‘
‘125’, ‘Fred FlintStone‘
‘126’, ‘Barney Rubble‘
Select TableB
Set relation to Custid into TableA
Scan
Replace Next 1 TableA.Cust_name with tableB.Cust_name
? Tablea.custid, TableA.Cust_name
endscan
Result:
123 Jon Doe
123 Gene Erik
123 Fred FlintStone
123 Barney Rubble
~
If I remove the trigger, the replace works fine and everything updates as it should- except of course the SQL table which was the point of the trigger in the first place. I’ve tried this with both VFP6 and 9 so it doesn’t appear to be a version issue.
Has anyone else ever come across this situation? And if so, what can we do to solve this.
Thanks
Hal