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)我都是这么判断的