On the line: bool travel = fill.travel.Value;
I am getting the following error:
Nullable object must have a value
and i am not sure why. All I want to do is get the value in the database of travel which is currently false. Any help would be appreciated.
using (var db = new DataClasses1DataContext())
{
var fill = (from f in db.expenseHdrs
where f.rptNo == getPkRowReport()
select f).FirstOrDefault();
txtReportDesc.Text = fill.description;
txtPeriod.Text = fill.period;
txtPurpose.Text = fill.purpose;
bool travel = fill.travel.Value;
chkTravel.Checked = travel
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…