【发布时间】:2010-10-14 18:50:24
【问题描述】:
一) public void GetEmployee(int EmployeeID);
<asp:ObjectDataSource SelectMethod=”GetEmployee” …>
<SelectParameters>
<asp:ControlParameter Name = ”EmployeeID” ...>
</SelectParameters>
如果出于某种原因 EmployeeID 参数为 NULL,则 ObjectDataSource 将 Null 转换为零并将其作为参数传递给 GetEmployee() 方法。
为什么运行时会进行这样的转换?不会扔一个
例外更有意义?
B) “使用 ConvertEmptyStringToNull 属性来指定是否
空字符串值在数据时自动转换为null
字段在数据源中更新。”
我不太明白这个属性的用处。为什么会
空字符串表示我们希望将 null 插入到源的
数据字段?我假设这个数据字段是字符串类型的?然后
为什么不也有 ConvertZeroInt32ToNull 等?
再见
【问题讨论】: