Rss & SiteMap
Foxtable(狐表) http://www.foxtable.com
If e.DataCol.Name = "住院号" Then
Dim vals() As String = e.NewValue.split(":")
If vals.length > 2 Then
e.DataRow("住院号") =vals(2)
Else
e.DataRow("住院号") =vals(0)
End If
Dim dr As DataRow = DataTables("入院登记").Find("[住院号] = '" & e.NewValue & "'")
If dr IsNot Nothing Then
e.DataRow("患者姓名") = dr("患者姓名")
Else
MsgBox("项目不存在,请重新输入!",64,"提示")
e.DataRow("患者姓名") = Nothing
End If
End If
执行后把姓名自动清空了
Dim dr As DataRow = DataTables("入院登记").Find("[住院号] = '" & e.NewValue & "'")
改为:
Dim dr As DataRow = DataTables("入院登记").Find("[住院号] = '" & e.DataRow("住院号") & "'")
Dim dr As DataRow = DataTables("入院登记").
改为:
Dim dr As DataRow = DataTables("入院登记").
我也试过,将Find("[住院号] = '" & e.NewValue & "'")改为Find("[住院号] = '" & e.DataRow("住院号") & "'")后可以返回姓名,但将住院号清空后又提示错误,姓名不能自动清空。
我的意思:
如果住院号匹配,找出匹配的姓名,
如果住院号不匹配,进行提示,
如果住院号为空,姓名为空。
If e.DataCol.Name = "住院号" Then
Dim vals() As String = e.NewValue.split(":")
If vals.length > 2 Then
e.DataRow("住院号") =vals(2)
Else
e.DataRow("住院号") =vals(0)
End If
If e.DataRow.Isnull("住院号") Then
e.DataRow("患者姓名") = Nothing
Else
Dim dr As DataRow = DataTables("入院登记").Find("[住院号] = '" & e.DataRow("住院号") & "'")
If dr IsNot Nothing Then
e.DataRow("患者姓名") = dr("患者姓名")
Else
MsgBox("项目不存在,请重新输入!",64,"提示")
e.DataRow("患者姓名") = Nothing
End If
End If
End If
最前面加上一个判断:
If e.NewValue = Nothing Then
Else
Dim vals() As String = e.NewValue.split(":")
If vals.length > 2 Then
e.DataRow("住院号") =vals(2)
Else
e.DataRow("住院号") =vals(0)
End If
..................
If e.DataCol.Name = "住院号" Then
Dim vals() As String = e.NewValue.split(":")
If vals.length > 2 Then
e.DataRow("住院号") =vals(2)
Else
e.DataRow("住院号") =vals(0)
End If
If e.DataRow.Isnull("住院号") Then
e.DataRow("患者姓名") = Nothing
Else
Dim dr As DataRow = DataTables("入院登记").Find("[住院号] = '" & e.DataRow("住院号") & "'")
If dr IsNot Nothing Then
e.DataRow("患者姓名") = dr("患者姓名")
Else
MsgBox("项目不存在,请重新输入!",64,"提示")
e.DataRow("患者姓名") = Nothing
End If
End If
End If
是不是语言逻辑错误
清空住院号时好像和这一段有冲突
Dim vals() As String = e.NewValue.split(":")
If vals.length > 2 Then
e.DataRow("住院号") =vals(2)
Else
e.DataRow("住院号") =vals(0)
End If
感觉问题出在此处
这样呢:
If e.DataCol.Name = "住院号" Then
If e.NewValue = Nothing Then
Else
Dim vals() As String = e.NewValue.split(":")
If vals.length > 2 Then
e.DataRow("住院号") =vals(2)
Else
e.DataRow("住院号") =vals(0)
End If
Dim dr As DataRow = DataTables("入院登记").Find("[住院号] = '" & e.NewValue & "'")
If dr IsNot Nothing Then
e.DataRow("患者姓名") = dr("患者姓名")
Else
MsgBox("项目不存在,请重新输入!",64,"提示")
e.DataRow("患者姓名") = Nothing
End If
End If
End If
或者把:
If e.NewValue = Nothing Then
Else
换成:
If e.DataRow.Isnull("住院号") Then
Else
这样呢:
If e.DataCol.Name = "住院号" Then
If e.NewValue = Nothing Then
Else
Dim vals() As String = e.NewValue.split(":")
If vals.length > 2 Then
e.DataRow("住院号") =vals(2)
Else
e.DataRow("住院号") =vals(0)
End If
Dim dr As DataRow = DataTables("入院登记").Find("[住院号] = '" & e.NewValue & "'")
If dr IsNot Nothing Then
e.DataRow("患者姓名") = dr("患者姓名")
Else
MsgBox("项目不存在,请重新输入!",64,"提示")
e.DataRow("患者姓名") = Nothing
End If
End If
End If
或者把:
If e.NewValue = Nothing Then
Else
换成:
If e.DataRow.Isnull("住院号") Then
Else
谢谢朋友,问题没有解决,清空住院号,错误依旧