AddWithValue nullable int Ask Question. Asked 10 years, 6 months ago. Active 7 years, 4 months ago. Viewed 4k times. In my data layer class, I initialize a parameter like so: private int? How should I handle this? Thanks in advance for any help. Bengal Bengal 4 4 silver badges 21 21 bronze badges. Add a comment.
Active Oldest Votes. You need to add an object : cmd. Value ;. SLaks SLaks k gold badges silver badges bronze badges. So the cmd takes care of boxing and unboxing? BTW, thank you everyone for your quick responses SLak's answer just jumped out at me and I understood it more quickly than the others.
Thank you all — Bengal. Joel Coehoorn Joel Coehoorn k gold badges silver badges bronze badges. You can use the null-coalescing operator : cmd. Daniel Hilgarth Daniel Hilgarth k 39 39 gold badges silver badges bronze badges.
Value ; else return collection. Chris Catignani Chris Catignani 4, 10 10 gold badges 33 33 silver badges 46 46 bronze badges. Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown. The Overflow Blog. Podcast Helping communities build their own LTE networks.
Podcast Making Agile work for data science. Featured on Meta. New post summary designs on greatest hits now, everywhere else eventually. Related Hot Network Questions. Question feed. Contents Exit focus mode.
Sql Parameter Collection. Please rate your experience Yes No. Any additional feedback? Namespace: System. SqlClient Assembly: System. In this article.
0コメント