Skip to Content

Adaptive Server Enterprise ADO.NET Data Provider - SET SHOWPLAN ON

Hi, I am trying to perform a SHOWPLAN on a query in order to see how it will run but I cannot seem to get it to return the SHOWPLAN using the ADO .NET Data Provider. It does not matter what the query is, SHOWPLAN does not return any information.

Query:

SET NOEXEC ON
SET SHOWPLAN ON


SELECT
	*


FROM
	table_name


WHERE
	id = 1

C#:

using (this._DBCommand = this._DBConnection.CreateCommand())
{
    this._DBCommand.CommandText = _Command;
    this._DBCommand.CommandTimeout = this._QueryTimeout;


    using (AseDataAdapter _DBDataAdapter = new AseDataAdapter(this._DBCommand))
    {
	_DBDataAdapter.Fill(_DataSet);
    }
}

The C# code will not fill the DataSet object with any information. I have tried the AseDataReader as well but the result is the same, no information. Any help would be greatly appreciated.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Oct 09, 2018 at 08:05 PM

    Hi,

    The showplan is actually not a dataset or result set.
    Showplan is a message.
    Example from TDS (Ribo):

    EED Token (0xE5); variable length.
    Length [2]: 62
    Message Number [4]: 10262
    Message State [1]: 1
    Message Class [1]: 10
    SQL State Length [1]: 5
    SQL State [5]: "ZZZZZ"
    Status [1]: NO_EED (0x00)
    Transaction State [2]: TDS_TRAN_SUCCEED (0x0001)
    Message Length [2]: 37
    Message Text [37]: " The type of query is SELECT. "
    Server Name Length [1]: 4
    Server Name [4]: "asename"
    Stored Proc. Name Length [1]: 0
    Line Number [2]: 0

    You would need to capture warning/information messages:
    I believe this is what you are looking for
    http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.infocenter.dc20066.0215/html/adonet2155/Infomessage_adodotnet_apir.htm

    Or you can do what I did and use Ribo.
    https://wiki.scn.sap.com/wiki/x/UgKlFw
    https://wiki.scn.sap.com/wiki/x/xYP8Ew

    Regards,
    Ryan

    Add comment
    10|10000 characters needed characters exceeded