Stored procedure doesn't allow null parameters even the parameter represent accept nulls?

前端 未结 2 1261
生来不讨喜
生来不讨喜 2021-01-14 14:57

I saw many questions on stack overflow, non of them touched my own problem

procedure or function expects parameter which was not supplied

2条回答
  •  一整个雨季
    2021-01-14 15:39

    You need to check your input for null and use DBNull.Value when you creating the parameters. If you pass just null as a parameter - ADO.Net will ignore that.

    EDIT:

    You can add that check into your custom method DataAccessLayer.CreateParameter()

提交回复
热议问题