It totally befuddles me why SQL Server allows DML without a FROM clause. In Oracle the test would be SELECT 1 FROM DUAL.
>When you use either SQLCONNECT or SQLSTRINGCONNECT, you should be able to test the return value of the connection handle. If it is < 0, the connection was not made.
>
>If you've already made a connection, testing it before use is a little harder. For SQL Server, I do the following:
>
>
> PROCEDURE test_connection(tnHandle)
> * tnHandle is the number of the connection handle
>
> LOCAL lcOnError, llError
>
> * turn the error handler off
> lcOnError = ON("ERROR")
>
> ON ERROR llSuccess = .f.
>
> llSuccess = SQLEXEC(tnHandle, "select 1")
>
> * restore the regular error handler
> ON ERROR &lcOnError
>
> RETURN llSuccess
> ENDPROC
>
>
>
>Hope that helps.
Mark McCasland
Midlothian, TX USA