Logo

Hacker’s Guide to Visual FoxPro
An irreverent look at how Visual FoxPro really works. Tells you the inside scoop on every command, function, property, event and method of Visual FoxPro.

SQLCancel()

This function quits execution of a command you’ve passed to the server. It’s relevant only when you’re in asynchronous mode.

Usage

nSuccess = SQLCancel( nConnectionHandle )

As far as we can tell, SQLCancel() always returns 1 as long as you give it a valid connection handle. It doesn’t matter if there’s actually something to cancel, or even if you’re in asynchronous mode.

Use this function when you’ve started a process and realize that it’s not such a good idea. We can think of a couple of handy ways to use this. For example, you might set up a timer and cancel after the specified time has elapsed. Or you might put up a message to the user indicating what’s happening and including a Cancel button. If the user presses Cancel, you use SQLCancel() to kill the process.

Example

nHandle = SQLConnect("Northwinds")
= SQLSetProp(nHandle, "Asynchronous", .T.)
= SQLExec(nHandle, "Select * FROM Customers,Orders")
* Oh, my goodness, it has no join condition!
= SQLCancel(nHandle)

See Also

SQLConnect(), SQLExec(), SQLPrepare(), SQLSetProp()