如何判断dataset中的数据是否为空值?

echo123321 2004-11-22 12:53:51
谢谢
...全文
851 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
learner01 2004-11-22
  • 打赏
  • 举报
回复
up!
dzvsyt 2004-11-22
  • 打赏
  • 举报
回复
If Ds.Tables("Table1").rows().Count=0 then
''空记录集
End if

IF TypeName(Ds.Tables("Talbe1").Rows(i).Item(0))="DBNull" then
''记录里的字段值为空
End If
46539492 2004-11-22
  • 打赏
  • 举报
回复
if ds.tables("table1").rows.count=0 then
..
end if
JadyZhu 2004-11-22
  • 打赏
  • 举报
回复
if (Dataset.Tables.Count == 0)
Responese.Write("数据集为空!");
amendajing 2004-11-22
  • 打赏
  • 举报
回复
应该这样dataset.tables[0].rows.count
colinliu 2004-11-22
  • 打赏
  • 举报
回复
dataset.tables("名").rows.count
or
dataset.tables(0).rows.count
Seeko0 2004-11-22
  • 打赏
  • 举报
回复
首先判断dataset中是否存在数据表
bool isNull=false;
if(ds.Tables.Count ==0){
isNull = true;
}
然后判断数据表中是否存在数据
for(int i=0;i<ds.Tables.Count;i++){ //表
for(int j=0;j<ds.Tables[i].Rows.Count;j++){ //行
for(int m=0;m<ds.Tables[i].Columns.Count;m++){ //列
if(ds.Tables[i].Rows[j][m] != null){
isNull =true;
break; //如果有一个字段不为空,表示存在数据
}
}
}
}
brightheroes 2004-11-22
  • 打赏
  • 举报
回复
if(dt.Rows[0][0] == DBNull.Value)
anycall2004 2004-11-22
  • 打赏
  • 举报
回复
if(dr.read())
{
return ture;
}
else
{
return false;
}
brightheroes 2004-11-22
  • 打赏
  • 举报
回复
dataset中的值只有可能是DBNull
不可能是Null
jxzhang615 2004-11-22
  • 打赏
  • 举报
回复
关注!!

62,041

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧