ExecuteWithResultsAndMessages Method

Description

Executes a Transact-SQL statement on a SQL Server. Returns any SQL Server messages received, including output from PRINT and DBCC statements. Returns results in a QueryResults object.

Visual Basic

QueryResults = SQLServer.ExecuteWithResultsAndMessages (
[Command :=] strSQLStatement,
[[Messages :=] strMessages] )

C++

HRESULT pSQLServer->ExecuteWithResultsAndMessages (
SQLOLE_LPCSTR
strSQLStatement,
LPSQLOLEQUERYRESULTS*
ppQueryResults,
SQLOLE_LPBSTR pstrMessages = 0 );

Elements


Element Type Description

QueryResults QueryResults Returned QueryResults object
strSQLStatement String SQL statement
strMessages String Returned SQL Server messages

QueryResults

The contents of the QueryResults object depend on the Transact-SQL statement.

Remarks

If a ServerSink object is configured to receive SQLServer events, the SQL Server messages are also sent to the ServerSink.ServerMessage method.

Reference

EXECUTE