日期:2014-05-18  浏览次数:20920 次

DataView 判断为空的方法
 
  执行如下操作:

  SqlDataAdapter adapter = new SqlDataAdapter(sql, clsMain.Gcon);
  DataSet ds = new DataSet();
  adapter.Fill(ds);
  DataView dv = ds.Tables[0].DefaultView;

如何判断 dv 中没有数据 即查询的结果为空呢??

------解决方案--------------------
if (搜索数据 != null && 搜索数据.Tables.Count > 0)
------解决方案--------------------
ds != Null&&ds.tables.count>0
------解决方案--------------------
ds.tables[0].rows[0].count>0
------解决方案--------------------
if(ds!=null && ds.tables.count!=0 && ds.tables[0].rows.count!=0)我都是这么判断的