Best method of assigning NULL value to SqlParameter

前端 未结 7 1383
野的像风
野的像风 2021-01-07 20:53

I have a number of optional input parameters I am using in a C# class method. Since the optional syntax creates a value of \'0\' when the parameter is not used, the SQL inse

7条回答
  •  误落风尘
    2021-01-07 21:12

    Consider using the Nullable(T) structure available. It'll let you only set values if you have them, and your SQL Command objects will recognize the nullable value and process accordingly with no hassle on your end.

提交回复
热议问题