改成
If dr1 IsNot Nothing AndAlso r.isnull("小区名称") AndAlso dr1("是否休假") <> "是" Then '如果找到了同名的产品行,也就是dr不是Nothing