7

The LA Fox Developer Newsletter
November 1997
Transaction Server (Con’t from page 1)

This is a good example of where MTS saves the day. Each
object is set up to require a transaction. If I instantiate an
Account object from within a Transfer object, then the Account
object inherits the Transfer object’s transaction! In this case the
Transfer object creates two instances of Account. The Account
object has each been written to commit or abort. They only
need to know if they can commit or abort their own data. They
don’t know about the other account or the Transfer object. If
account object A commits because the deposit went OK and B
commits because there is enough money to withdraw then the
Transfer object commits and all transactions end at the same
time. But if A commits and B aborts then the Transfer object
aborts and A is rolled back. Yet no code must be changed in
the Account objects in order to deal with this scenario.

Very cool.

Here’s another scenario. Let’s say I have lots of objects con-
necting to a database. Each connection takes resources and
perhaps even a license, depending on the database. How do I
manage them so I don’t have too many or so I’m not opening
and closing connections constantly? In VFP 5 I use an out-of-
proc server with views that share connections. The server opens
a connection in the default data session and keeps it open so
that other views, in private data sessions, can share it. Works
OK, but isn’t very scalable and requires that all the components
work in that process.

With MTS, the Connections are pooled with a connection
manager. When I create an object that needs a connection the
manager looks for an unused Connection and uses it if it can.
Then, when I attempt to send back data the manager will go
back into the pool and reallocate a connection. This keeps the
number of connections to a minimum and improves performance
without me having to do any stupid tricks like I have to do now.

These are just two examples of how MTS can greatly simplify
the life of a developer, while increasing the robustness, perfor-
mance and efficiency of application components.

[Ed.Note: Gary DeWitt is the senior software Wizard for
MedSoft Inc, a medical software company located in Sunny
Lake Tahoe, CA, USA. Gary is a regular contributor to FoxPro
Advisor, Fox Talk, the Virtual FoxPro User Group Newsletter and
other software related publications. Gary is also a FoxPro MVP
and holds other certifications from Microsoft as well.

Formore on Microsoft Transaction Server (MTS):

http://www.microsoft.com/transaction/default.asp

http:/i204. 203.124. 10/pdc/html/seybold.htm

(600k Word DOC file download available)
(Con’t, page 8)
Special Big Announcement
The LA Fox Developer’s Group has entered into an agree-
ment with Macmillan Computer Publishing. LA Fox mem-
bers can now purchase all Macmillan Computer Publishing
titles at a discount of 30% off retail pricing.

Macmillan owns the following publishers:
Que
New Riders Press
The Waite Group
Ziff-Davis
Sams/sams.net
Que Education & Training
Macmillan Technical Publishing
Hayden
Adobe Press
Borland Press
Lycos Press

With all these publishers and over 40% market share,
Macmillan has the best books for Computer technology.

To take advantage of this offer, you must be a member-in-good-
standing (read current and paid-up) and have a credit card. You
can receive our special account number and the 800 access
number by calling me at 800/499-6237 or 714/375-3300, ore-
mailing me at CompuServe (72723,3422) or brlee@earthlink.net.

FoxPro Q&A (Con't from page 6)
x.f.
return .t.
else
x.t.
return .f.
endif

Now preview the report and you will find Alternate lines shaded
grey.


Q Can I change the description of one or more radiobuttons as
the program runs?

A You can use the SHOW GET command with the PROMPT
clause to programmatically change the prompt of the
radiobuttons.

Example: If the variable name is, say ‘rb’, and you have three
buttons in the radiobutton set, then use:

SHOW GET rb,1 PROMPT “abcd”
SHOW GET rb,2 PROMPT "abc"
SHOW GET rb,3 PROMPT “ab”

[his changes the prompts to ‘abcd’,’abc’ and ‘ab’.
Page 7

7