Foxtable(狐表)用户栏目专家坐堂 → [求助] 这段代码为什么通不过,


  共有22281人关注过本帖树形打印复制链接

主题:[求助] 这段代码为什么通不过,

帅哥哟,离线,有人找我吗?
cpayinyuan
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信 一级勋章
等级:六尾狐 帖子:1412 积分:8937 威望:0 精华:0 注册:2008/9/1 8:57:00
  发帖心情 Post By:2009/5/8 13:32:00 [显示全部帖子]

少了个 if dr isnot nothing的判断,你只判断dr("项目名称")是否为空,没有考虑dr也可能为空。

补充:4楼的代码好像不太准确,dr是nothing,与dr("项目名称")为空是两回事,直接代替不太合适。

If e.DataCol.Name = "上级项目名称" Then

   Dim dr As DataRow

   dr = DataTables("项目明细").Find("[工程序号] = '" & Tables("项目信息").Current("序号") & "' and [项目名称] = '" & e.datarow("项目名称") & "'","编号 Desc")

  if dr isnot nothing
  
if dr.IsNull("项目名称")  Then

      e.datarow("选择标记") = false

   else

      e.datarow("选择标记") = true

   end if
  
end if
end if

[此贴子已经被作者于2009-5-8 13:36:35编辑过]

 回到顶部