0

我正在尝试做一些我认为很简单的事情。

我有一个名为 loc 的列表。然后我有代码

dim locdt = nothing
locdt = EML_StaffingDataSet.TSTAFFRSTR.Select.Where(Function(x As DataRow) loc.Contains(x.Item("rstr_location"))).Distinct

这很好用,但是当我尝试使 locdt 成为控件的数据源时,我收到一个空错误,“从类型 'DBNull' 到类型'String' 的转换无效。” 一些 rstr_locations 是空的,所以在上面的代码中,我如何从选择中删除空值。

4

1 回答 1

0

弄清楚了。

locdt = EML_StaffingDataSet.TSTAFFRSTR.Select("rstr_location is not null").Where(Function(x As DataRow) loc.Contains(x.Item("rstr_location"))).Distinct

我现在如何将其转换为数据表,以便我可以查询以仅返回 rstr_location

于 2017-03-21T13:51:42.223 回答