DeKoss
DeKoss

Reputation: 447

Visual FoxPro DB stored procedure call to Windows service

I need to use a DB trigger in a FoxPro database on a 2003 server to trigger a stored procedure to call a window service of my design so I can access another SQL Server. Can you think of an idea of how to extend the call from the stored procedure to a Window service?

VFP trigger calls the stored procedure UpdateTable:

FUNCTION UpdateTable
LPARAMETERS lcTableName, lnRecordID

   callToWinService(lcTableName, lnRecordID)

RETURN
ENDFUNCTION

Clearly I do not know how to pass the data to the Windows service. Last time I did that was a few years ago. Any help would be appreciated

And, yes, I can create a Windows service with VFP code in an EXE file.

Upvotes: 0

Views: 459

Answers (1)

Alan B
Alan B

Reputation: 4288

Assuming you mean a Windows service, you can't call it with parameters because presumably it's already running as of Windows start-up.

The Windows service would have to expose some way of handling communications in and out. There are various ways of achieving this, some depending on what technology was used to create the service:

  • Sockets
  • Named Pipes
  • Windows Communication Foundation if it's a .NET service
  • Shared Memory
  • RPC

If you're calling an EXE with parameters, then those get passed to whatever PRG is set as the main program of your VFP project.

But why are you taking this approach? Why not just use SQLCONNECT(), SQLEXEC() and so on from within the trigger?

Upvotes: 3

Related Questions