>>Snip..
>>>Hi Barbara:
>>>
>>>That's what I needed to know. I don't get errors know, but the base still is not being updated. Do I have to do something to comit the change to the base table?
>>>
>>>Ed
>>Hi Ed,
>>Could you please write your revised code ?
>>Cetin
>
>Hi Cetin:
>
>Here it is:
>
>TableA (2.6 table)
>ViewA (Updateable view made up of fields from TableA)
>
>llSuccess = .T.
>CURSORSETPROP("buffering", 5, "ViewA")
>
> BEGIN TRANSACTION
> IF !UpdateTableA()
> llSuccess = .F.
> ENDIF
> IF !UpdateTableB()
> llSuccess = .F.
> ENDIF
> IF !UpdateTableC()
> llSuccess = .F.
> ENDIF
>
> IF llSuccess = .T.
> ENDTRANSACTION
> ELSE
> ROLLBACK
> ENDIF
>
> ********************
> Method UpdateTableA (UdateTableB and UpdateTableC the same)
>
> SELECT ViewA
> APPEND BLANK
> REPLACE ViewA.Field1 WITH "Test",
> ViewA.Field2 WITH "Test2"
>
> TABLEUPDATE(0,.T., "ViewA")
Hi Ed,
Am I missing something here ? (Assumed function really returned the tableupdate result instead of .t. always)
- Call uptadetableA -> Add a record to TableA with "test","test2" + blank record to TableB+TableC
- Call uptadetableB -> Add a record to TableB with "test","test2" + blank record to TableA+TableC
- Call uptadetableC -> Add a record to TableC with "test","test2" + blank record to TableA+TableB
Doing one "append blank" to view + replacing all necessary fields then tableupdate() would update base tables A,B,C provided all necessary keyfields and updatable fields are set. And why use tableupdate(0) instead of tableupdate(2) (buffering -> 5) ?
So try with this code :
CURSORSETPROP("buffering", 5, "ViewA")
BEGIN TRANSACTION
insert into ViewA ;
(Field1,Field2,Field3,Field4,Field5,Field6) ;
values ;
("TestA","Test2A","TestB","Test2B","TestC","Test2C")
IF tableupdate(2,.t.,"ViewA")
END TRANSACTION
ELSE
ROLLBACK
ENDIF
Cetin