Forum Discussion
woptastic1
4 years agoAdvocate I
Bug in CommentBelongsToUser stored procedure ReportServer database
Have May 2022 installed using custom authentication, user can create comments but then if they try to delete a comment, error pops up stating An error has occurred. An error occurred within the repor...
v-luwang-msft
4 years agoCommunity Support
Hi woptastic1 ,
Sadly, SqlCommand objects ignore any SqlParameter object in their .Parameters collection with a value of null.In my opinion, this is by design.
There are two solutions to this problem that I found.
-
In our stored procedures, give a default value to each parameter, so from @Parameter int to @Parameter int = NULL (or some other default value as required).
-
In our code that generates the individual SqlParameter objects, assigning DBNull.Value instead of null where the intended value is a SQL NULL does the trick.
refer:
Did I answer your question? Mark my post as a solution!
Best Regards
Lucien