【发布时间】:2010-12-10 23:00:12
【问题描述】:
我正在尝试使用 DataSet 设计器从查询中创建数据表。我把这个记下来就好了。使用的查询从数据库返回一个可为空的日期时间列。但是,当涉及到这段代码时:
DataSet1.DataTable1DataTable table = adapter.GetData();
这会从以下位置引发 StrongTypingException:
[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;
}
}
如何使用设计器让该列可以为 Nullable?
【问题讨论】: