【发布时间】:2014-02-01 17:54:49
【问题描述】:
我读过
What is the difference between null and System.DBNull.Value?
INSERT / UPDATE data using DBNull or null?
和类似的问答,但不太明白这一点。 问题:
tableAdapter 允许我将 null 存储到不可为空的字段中 (AllowDBNull = false)。
我需要检查什么?
我可以检查
string.Lenght == 0
string.IsNullOrEmpty(string)
string.text = ""
在更新命令之前,但想知道为什么表适配器让我存储 NULL
它实际上是存储 someTextBox.Text = "" 时需要抛出异常 null 不允许某些字段。
我有完全相同的问题Dataset allowing Null values even when AllowDBNull = False?,但没有解决方案。
谢谢
【问题讨论】:
-
你有类型化或非类型化数据集吗?
-
@HABJAN 类型化数据集
标签: c# .net winforms dataadapter