Foxtable(狐表)用户栏目专家坐堂 → [求助]代码错误,但不知错在何处,望高手赐教!


  共有10704人关注过本帖平板打印复制链接

主题:[求助]代码错误,但不知错在何处,望高手赐教!

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


加好友 发短信
等级:童狐 帖子:212 积分:1564 威望:0 精华:0 注册:2011/7/20 21:00:00
[求助]代码错误,但不知错在何处,望高手赐教!  发帖心情 Post By:2011/8/27 17:27:00 [只看该作者]

If e.DataCol.Name = "住院号" Then
    If e.DataRow("住院号") IsNot Nothing Then
        Dim dr As DataRow = DataTables("长期医嘱").Find("[住院号] = '" & e.DataRow("住院号") & "'  ")
        If dr IsNot Nothing Then
            Dim cf As DataRow = DataTables("收费项目").Find("项目名称 = '餐费标准'")
            Dim jc As DataRow = DataTables("长期医嘱").Find("项目名称 = '诊疗费'And 执行 =1 And [住院号] = '" & e.DataRow("住院号") & "'")
            e.DataRow("本月开嘱日期") = DataTables("长期医嘱").Compute("min(开嘱日期)","[住院号] = '" & e.DataRow("住院号") & "'")
            e.DataRow("本月停嘱日期") = DataTables("长期医嘱").Compute("max(停嘱日期)","[住院号] = '" & e.DataRow("住院号") & "'")
            e.DataRow("假出日期") =jc("停嘱日期")
        Else
            e.DataRow("本月开嘱日期") = Nothing
            e.DataRow("本月停嘱日期") = Nothing
            e.DataRow("假出日期") =Nothing
        End If
    End If
End If

 

问题出在红色字体的代码上,加了条件[住院号] = '" & e.DataRow("住院号") & "'后出现问题。

 

 不管 执行 =1还是 执行 =true,代码分开写后,运行结果正确,代码如下:

If e.DataCol.Name = "住院号" Then
    If e.DataRow("住院号") IsNot Nothing Then
        Dim dr As DataRow = DataTables("长期医嘱").Find("[住院号] = '" & e.DataRow("住院号") & "'  ")
        Dim jc As DataRow = DataTables("长期医嘱").Find("项目名称 = '诊疗费'And 执行 =True And [住院号] = '" & e.DataRow("住院号") & "'")
           If dr IsNot Nothing Then
            Dim cf As DataRow = DataTables("收费项目").Find("项目名称 = '餐费标准'")
            e.DataRow("本月开嘱日期") = DataTables("长期医嘱").Compute("min(开嘱日期)","[住院号] = '" & e.DataRow("住院号") & "'")
            e.DataRow("本月停嘱日期") = DataTables("长期医嘱").Compute("max(停嘱日期)","[住院号] = '" & e.DataRow("住院号") & "'")
                   Else
            e.DataRow("本月开嘱日期") = Nothing
            e.DataRow("本月停嘱日期") = Nothing
                   End If
        If jc IsNot Nothing Then
            e.DataRow("假出日期") =jc("停嘱日期")
        Else
            e.DataRow("假出日期") =Nothing
        End If
    End If
End If

[此贴子已经被作者于2011-8-27 18:17:13编辑过]

 回到顶部