我该如何为您在DataView.RowFilter空白 [英] How do I check for blank in DataView.RowFilter

查看:740
本文介绍了我该如何为您在DataView.RowFilter空白的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我有一列称为A,我要检查是否为空或空白,什么是检查这个使用数据视图的RowFilter,它的正确方法:

Assuming I have a column called A and I want to check if A is null or blank, what is the proper way to check for this using the DataView's RowFilter:

DataTable dt = GetData();

DataView dv = new DataView(dt);

dv.RowFilter = "A IS NOT NULL OR A IS NOT ''";

以上似乎并不虽然工作。

The above doesn't seem to work though.

推荐答案

您绑到.NET< 3.5?如果没有你可以使用LINQ查询一栏的状态。

Are you tied to .net < 3.5? If not you can use linq to check the state of a column.

另外还有一个 ISNULL(,)之类的函数在T-SQL:

Otherwise there is an Isnull(,) function like in T-SQL:

dv.RowFilter = "Isnull(a,'') <> ''";

这篇关于我该如何为您在DataView.RowFilter空白的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆