I've been using Insight.Database for about a year to invoke stored procedures, but I've only just run into a situation where the stored procedure has a defaultable nullable parameter that Insight doesn't handle as I was expecting.
Briefly, the parameter is defined as paramName nvarchar(10) = ''
. The code to invoke this proc was old fashioned SqlCommand/SqlParam code that simply did not set the param at all. I was replacing this with a .net object:
Class MyObject
Public Property paramName As String
....
End Class
Suppose you create an object of this type, do NOT set paramName
and pass it to the proc. I would have expected that the proc would use the default value. But what happens instead is that Insight sends a NULL value to the proc, which is NOT the same as not sending anything, the proc sees a specified parameter and so doesn't use the default value, and this particular proc actually handled NULL is a different way from the default, which broke the app.
I would argue that the bug is in the proc, but I still need a way to control nullable parameter behavior so I can call procs of this kind that I can't modify.