I have strongly typed dataset. Now I want to do a select on a datatable with linq.
My problem is that this table have numeric columns that allows null-values. But if there are datarows that have in this columns no values, I don’t know to make the Select- command.
This is my query:
var query = from tab1 in localDataSet.simpleTable
select new {
line = tab1.IsLineNull ? null : tab1.line,
wait = tab1.IswaitNull() ? null : tab1.wait
}
I can’t set line = null if tab1.IsLineNull() returns true, because the datatype ‘decimal’ (and all other number valuetypes) can’t be null. But what should I choose instead? I can’t choose 0 either.
I assume that you don’t know how to create a
Nullable<T>: