1. Daryl Foster
  2. SnapObjects
  3. Thursday, 19 May 2022 06:22 AM UTC

Hi, we've been using SnapObjects for quite a while without too many issues, but today we found that one of our stored procedure calls truncates the output parameter to 4000 characters.  Is that configurable in SnapObjects, or is it a hard limit? We are using SnapDevelop 2021.

The code is:

    var detailParam = ParamValue.Output<string>("dets");
                            
    try    
    {
        // Executes the stored procedure and gets the details in detailParam.
        // But it truncates detailParam to 4000 characters.
        _dataContext.SqlExecutor.ExecuteProcedure(procedureName, idParam, argParam, detailParam);
    }

 

Accepted Answer
David Xiong @Appeon Accepted Answer Pending Moderation
  1. Friday, 20 May 2022 06:57 AM UTC
  2. SnapObjects
  3. # Permalink

Hi Daryl,

SnapObjects' stored procedure output ParamValue does have a 4000 characters limit. We've recorded this issue and reported it to the development. At this moment, you can use the following workaround that you came up with to solve the issue:
var detailParam = ParamValue.InputOutput<string>("dets", new string(' ', 4001));

Regards,
David

Comment
There are no comments made yet.
Daryl Foster Accepted Answer Pending Moderation
  1. Friday, 20 May 2022 00:42 AM UTC
  2. SnapObjects
  3. # 1

I just realised that ParamValue.Output also has a size parameter, so I've tried that and it doesn't seem to do anything:

 

var detailParam = ParamValue.Output<string>("dets", 10000);

 

I've also updated to the latest SnapObjects 3.1 but still no luck. Anyone know how to get a stored procedure to return an output parameter with more than 4000 characters?

 

 

 

Comment
There are no comments made yet.
Daryl Foster Accepted Answer Pending Moderation
  1. Friday, 20 May 2022 01:26 AM UTC
  2. SnapObjects
  3. # 2

Sorry, I'm back again. I may have found a solution, but it seems a bit dodgy and I was hoping to get some feedback from someone at Appeon on whether this is the correct approach. I've found that if I use an InputOutput ParamValue and initialise it with a string with a length of 4001 it will return the full length of the varchar(max) output parameter from the stored procedure.

var detailParam = ParamValue.InputOutput<string>("dets", new string(' ', 4001));
Comment
There are no comments made yet.
Daryl Foster Accepted Answer Pending Moderation
  1. Friday, 20 May 2022 07:51 AM UTC
  2. SnapObjects
  3. # 3

No worries, thanks David.

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.