Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How do you ROLLBACK a view
Message
From
06/03/1998 06:07:35
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
05/03/1998 12:33:46
Edward Crawford
City Facilities Management
Glasgow, United Kingdom
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00082524
Message ID:
00082916
Views:
35
>>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 :
* In viewA
* TableA - Field1,Field2
* TableB - Field3,Field4
* TableC - Field5,Field6
 
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
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform