SqlOk%

Verifies the correctness of a command batch.

Syntax

SqlOk% ( sqlconn% )

where

sqlconn%
Is a SQL Server connection. The value of sqlconn% is returned by SqlOpen%.

Returns

SUCCEED (1) or FAIL (0). The most common reason that a statement fails is a Transact-SQL syntax error.

Remarks

SqlOk% following SqlSend% is the equivalent of SqlExec%. SqlOk% must be called after SqlSend% returns SUCCEED. When SqlOk% returns SUCCEED, SqlResults% can be called to process the results. SqlOk% is useful in text-update operations. When text is sent to SQL Server using SqlMoreText%, SqlOk% must be called before the first call to SqlMoreText% and after the last call to SqlMoreText%. For an example of using SqlOk% in this context, see "SqlWriteText%."

Note This function is one of the four that do not return control to the application until the server sends the required response. The application can be blocked for a considerable time if the server is waiting for a lock or processing a large sort. If this is unacceptable, always call SqlDataReady% before SqlOk% and set the DB-Library timeout to regain control periodically.

See Also

SqlCmd%, SqlExec%, SqlNextRow%, SqlResults%, SqlSend%, SqlSetTime%