我使用此代码从我的数据库中获取数据
var table = kantarDataSetTartimlarTableAdapter.GetData().Select(s => new
{
s.DateColumn,
s.Index
}).AsEnumerable().Select ((s, column) => new
{
s.DateColumn,
s.Index
column_no = column + 1
});
如果date column
不是null
,我没有任何问题。但是当date column
有null
数据时我有问题:
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public System.DateTime event_start_date {
get {
try {
return ((global::System.DateTime)(this[this.tableDataTable1.event_start_dateColumn]));
}
catch (global::System.InvalidCastException e) {
throw new global::System.Data.StrongTypingException("The value for column \'event_start_date\' in table \'DataTable1\' is DBNull.", e);
}
}
set {
this[this.tableDataTable1.event_start_dateColumn] = value;
}
}
我该如何解决这个错误?