質問

In essence my question is really about DBNull.Value. What is it compared to just null? It seems you cannot simply pass a 'null' to a command parameter unless it's a DBNull.Value, otherwise the database will reject it, but why?

役に立ちましたか?

解決

yes when you are passing a datetime values especially you need to pass with DBNull.value. Because you are passing date time inside single quote if you place 'Null' like this it is treated as a string or varchar. In the same way if you pass DBNull.value means this value is not passed so sql will treat it as null.

Please visit this link. here they explained with example. This may help you.

http://onlydifferencefaqs.blogspot.in/2012/09/null-keyword-vs-dbnull-class-in-c.html

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top