i am getting error in the code getting error The value for column 'TotalValue' in table 'wsm_View_PurchaseOrderList' is DBNull.
public decimal TotalValue {
get {
try {
if (object.ReferenceEquals(tablewsm_View_PurchaseOrderList.TotalValueColumn, DBNull.Value)) {
return 0.0;
} else {
return Convert.ToDecimal(this(this.tablewsm_View_PurchaseOrderList.TotalValueColumn));
}
} catch (System.InvalidCastException e) {
throw new global::System.Data.StrongTypingException("The value for column 'TotalValue' in table 'wsm_View_PurchaseOrderList' is DBNull" + ".", e);
}
}
set { this(this.tablewsm_View_PurchaseOrderList.TotalValueColumn) = value; }
}
Try checking for DBNull like this:
if (Convert.IsDBNull(tablewsm_View_PurchaseOrderList.TotalValueColumn))
{
return 0.0;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.