0

I am trying to debug stored procedure through Visual Studio 2015 and would like to see value of User Defined Table type.

Script of User Defined Table Type:

CREATE TYPE [dbo].[tp_CommercialActCarSends] AS TABLE(
    [ID] [int] NOT NULL,
    [ArriveDate] VARCHAR(25) NULL,
    [id_Person] [int] NULL,
    [CalcWeight] [DECIMAL](18,3) NULL   
)
GO

And code of stored procedure:

CREATE PROCEDURE [dbo].[MyStoredProcedure](
    , @CommercialActCarSends        tp_CommercialActCarSends READONLY
        , @UserID                       INT = NULL
)
AS
...

I populate ‘DataTable’ object ‘comActsDataTable’ with some data and pass the ‘comActsDataTable’ to the stored procedure through C#:

var reqRes = db.Database.SqlQuery<dynamic>("EXEC dbo.MyStoredProcedure @UserID = @UserID, 
    @CommercialActCarSends = @CommercialActCarSends"
    , InitSqlParameter("@UserID", SqlDbType.Int, usrid)
    , InitSqlParameter("@CommercialActCarSends", SqlDbType.Structured, comActsDataTable, 
    "tp_CommercialActCarSends")

What I see in Visual Studio is just:

enter image description here

Is it possible to see what values of tp_CommercialActCarSends stored procedure received while debugging in Visual Studio?

5
  • 1
    Why not create a break point and look at comActsDataTable? Commented Nov 21, 2017 at 17:39
  • @SeanLange As I really want to see what I sent to the Stored Procedure to debug errors. Commented Nov 21, 2017 at 17:49
  • @SeanLange is it possible to read values of ‘tp_CommercialSctVatSends’ while debugging? Commented Nov 21, 2017 at 17:51
  • It would be the same contents as your DataTable. But if you really want to see the contents you would probably need to create a table and insert into that table in your procedure code. Then when it finishes the procedure you could examine the contents of that table. AFAIK you cannot view the actual contents of the parameter value in dotnet when you have a table valued parameter. Commented Nov 21, 2017 at 19:19
  • @SeanLange Could you make your comment as an answer and I will mark it! Thanks! :) Commented Nov 22, 2017 at 6:31

1 Answer 1

1

It would be the same contents as your DataTable. But if you really want to see the contents you would probably need to create a table and insert into that table in your procedure code. Then when it finishes the procedure you could examine the contents of that table. AFAIK you cannot view the actual contents of the parameter value in dotnet when you have a table valued parameter.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.