Re: Triggering an application from SQL Server?
- From: "David Portas" <REMOVE_BEFORE_REPLYING_dportas@xxxxxxx>
- Date: Mon, 17 Sep 2007 22:57:46 +0100
"Linn Kubler" <lkubler@xxxxxxxxxxxxxxxxxx> wrote in message
news:e2fJeFX%23HHA.748@xxxxxxxxxxxxxxxxxxxxxxx
Hi,
I was just wondering would it be possible to have a trigger in a SQL 2000
database launch a VFP application to print a label? I think setting up
the trigger is pretty straight forward but having it launch a VFP
application is more tricky. I guess the trigger would have to pass a
couple parameters that the application would use for a look up.
Is this possible and what would I have to do on the VFP end to make it
work?
Thanks in advance,
Linn
For a number of reasons it wouldn't be sensible to attempt such a thing from
a trigger. A trigger executes in the context of a transaction - ie. *before*
that transaction has committed, so you could end up printing data for a
phantom transaction that later gets rolled back. You'll cause unnecessary
blocking by holding the transaction longer than you need to. Also, if your
VFP application opens a new connection to the database then you could
possibly induce an undetectable deadlock.
I'd say the "right" place to do this is within whatever process caused the
update in the first place - not within a trigger.
If you must do it from SQL code then do so *outside* a transaction. Use
xp_cmdshell to execute your program in a DOS shell. Another alternative
would be to use COM via the sp_OA procs (see sp_OACreate in Books Online)
but in my experience that approach is too prone to memory leakage.
Finally, have you considered using SQL Server Reporting Services to print
your labels?
Hope this helps.
--
David Portas
.
- Follow-Ups:
- Re: Triggering an application from SQL Server?
- From: Linn Kubler
- Re: Triggering an application from SQL Server?
- References:
- Triggering an application from SQL Server?
- From: Linn Kubler
- Triggering an application from SQL Server?
- Prev by Date: Re: Lost dev environment
- Next by Date: Re: Distributing my application?
- Previous by thread: Triggering an application from SQL Server?
- Next by thread: Re: Triggering an application from SQL Server?
- Index(es):
Relevant Pages
|