Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在使用 AddInParameter 方法插入空参数时遇到问题。
cmd.AddInParameter(someString, someValueWhichCanBeNULL)
一旦第二个参数为空,它就会失败。我也试过 DBNull.Value,也失败了。想法?
消息是:AddInParameter @MyParam 具有空值或不支持的属性类型:DBNull
谢谢!
使用AddInParameter需要三个参数的重载;你要这个:
AddInParameter
cmd.AddInParameter(someString, DbType.String, someValueWhichCanBeNULL);
(它不能单独从 DBNull.Value 确定参数的类型)
希望有帮助!