我在数据库中有一张桌子:
REGULAR(num(bigint) not allow null, title(nvarchar(10)), content(nvarchar(500)), path(nvarchar(50)) allow null)
有一些数据:
1.REGULAR1(1|title1|content1|path1)
2.REGULAR2(2|title2|content2|)--> path is not inputed (null)
我在 SQL DB server 2008 中执行了一些查询:
1. select PATH from REGULAR where num='2'; -> result is PATH:NULL
但
2. select count(*) from REGULAR where PATH = NULL; --> result is COUNT:0 (it must be 1 which has num=2)
因此,当我从 Webform 执行查询时,它会出错
string sql= select * from REGULAR;
Datatable regular= excute(sql)....
for(int i=0;i<regular.Rows.Count; i++)
{
if(regular.Rows[i]["path"]!=null)
{
Textbox1.Text= "a";//do something else...
}
else
Textbox1.Text+="b";//...
}
结果是:Textbox.Text= "ab"
--->它很可能是“a”。有错吗???