locked
how to call tvp from ExecuteFuntion. RRS feed

  • Question

  • User2102072086 posted

    hi , is it the right way

    DataTable ActivityRoutineParameter = new DataTable();
    
                    ActivityRoutineParameter.Columns.Add("p1", typeof(long));
                  
                    
    
                    ActivityRoutineParameter.Columns.Add("p2", typeof(long));
               
    
                    System.Data.Objects.ObjectParameter[] objValParams = new System.Data.Objects.ObjectParameter[2];
                    objValParams[0] = new System.Data.Objects.ObjectParameter("@tvpActivityRoutineParameter", ActivityRoutineParameter);
                    System.Data.Objects.ObjectParameter objValidationResult = new System.Data.Objects.ObjectParameter("xmlResult", typeof(System.String));
                    objValParams[1] = objValidationResult;
    
                    var varResponse = context.ExecuteFunction("uspValidation1", objValParams);

    CREATE TYPE ActivityRoutineParameter AS TABLE ( PipeFromId BIGINT NULL ,PipeToId BIGINT NULL ) GO

    CREATE PROCEDURE uspValidation1 @tvpActivityRoutineParameter dbo.ActivityRoutineParameter READONLY, @xmlResult [xml] = null OUTPUT AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. SET NOCOUNT ON; SELECT @xmlResult END GO

    Tuesday, December 1, 2020 10:46 AM

All replies