DataView 判断为空的方法 执行如下操作: SqlDataAdapter adapter = new SqlDataAdapter(sql, clsMain.Gcon); DataSet ds = new DataSet(); adapter.Fill(ds); DataView dv = ds.Tables[0].DefaultView;如何判断 dv 中没有数据 即查询的结果为空呢?? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 if (搜索数据 != null && 搜索数据.Tables.Count > 0) 必须两个条件都满足啊 如同我的代码:ds.tables.count>0 && ds != Null是这样嘛? ds != Null&&ds.tables.count>0 if(ds!=null && ds.tables.count!=0 && ds.tables[0].rows.count!=0)我都是这么判断的 vb.net:if dv isnot nothing then if dv.count>0 then ... else messagebox.show("数据为空") end if messagebox.show("查询失败")end if 写错了,正确的是:if dv isnot nothing then if dv.count>0 then ... else messagebox.show("数据为空") end ifelse messagebox.show("查询失败")end if 写程序重点在调试,如果[搜索数据]不是表怎么可能会有[.Tables.Count]?看语句不一定就能非常明白,调试决定一切。 真的快dead了 窗口调用问题 C#日历问题,帮我看看这个错在哪,1900年1月是对的,2011年11月显示是错的 serialport发送数据 ClickOnce中Com组件如何注册 为什么不能完全禁止右键 菜鸟问一个关于函数间参数传递的问题 button能否使用ico做为图片 学习抓包,分析,实现登陆(c#) 怎样绘制表单? 辛苦你们了! WPF 动态生成界面! 有关sslstream 问题请教
是这样嘛?
if dv isnot nothing then
if dv.count>0 then
...
else
messagebox.show("数据为空")
end if
messagebox.show("查询失败")
end if
if dv isnot nothing then
if dv.count>0 then
...
else
messagebox.show("数据为空")
end if
else
messagebox.show("查询失败")
end if