這裏是我的腳本:無法轉換的源類型System.Nullable <double>
public PlainBrgDataSummaryComplete SummaryComputationPerTransSQLite(long ProgramID)
{
PlainBrgDataSummaryComplete result = new PlainBrgDataSummaryComplete();
DataSet dataSet = GetPlainBrgDataSQLite(ProgramID);
var abcde = dataSet.Tables["dataBridge"]
.AsEnumerable()
//.Where(a => Convert.ToDateTime(a["reportingDate"].ToString()) >= startOfWeek1 && Convert.ToDateTime(a["reportingDate"].ToString()) < endOfWeek1.AddDays(1))
.GroupBy(a => 1)
.Select(d =>
new PlainBrgDataSummaryTrans
{
transactionWk6 = d.Sum(a => a.Field<double?>("TranCount"))
}
).FirstOrDefault();
result.totaltransaction = new PlainBrgDataSummaryTrans
{
transactionWk6 = abcde;
};
return result;
}
我得到的錯誤 - 不能源類型轉換爲System.Nullable<double>
。具體在transactionWk6 = abcde
部分;
是什麼transactionWk6的PlainBrgDataSummaryTrans類的類型? – Umamaheswaran
public double? transactionWk6 {get;組; } –
你在運行時正確的錯誤? – Umamaheswaran