簡體   English   中英

在這種情況下如何使用Expression處理DBNull?

[英]How to handle the DBNull with Expression in this case?

我使用以下代碼片段來進行一些比較

Expression.Constant(DBNull.Value, typeof (Int32));

執行這些行時,我得到以下異常

System.ArgumentException occurred
HResult=-2147024809
Message=Argument types do not match
Source=System.Core
StackTrace:
   at System.Linq.Expressions.Expression.Constant(Object value, Type type)
InnerException:

傳遞System.Data.SqlTypes.SqlInt32.Null而不是DBNull.Value

Expression.Constant(SqlInt32.Null, typeof (Int32));

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM