พอดีรัน seach แล้วมัน error Ambiguous Match Exception
Code
Overload resolution failed because no Public 'UCase' can be called with these arguments: 'Public Shared Function UCase(Value As Char) As Char': Argument matching parameter 'Value' cannot convert from 'DBNull' to 'Char'. 'Public Shared Function UCase(Value As String) As String': Argument matching parameter 'Value' cannot convert from 'DBNull' to 'String'.
If UCase(keysearch) = UCase(DS.Tables(0).Rows(k)("surename")) Then
Private Sub GotoSearch()
Dim Found As Boolean
Dim keysearch As String
' ID tblpatient
If rdoHN.Checked = True Then
OpenDB()
CN.Open()
Found = False
keysearch = txtFind.Text
For k As Integer = 0 To DS.Tables(0).Rows.Count - 1
If UCase(keysearch) = UCase(DS.Tables(0).Rows(k)("HospitalNo")) Then
i = k
Found = True
Exit For
End If
Next k
If Found = False Then
MsgBox("ไม่มี HN นี้อยู่ในฐานข้อมูล", MsgBoxStyle.Exclamation, "ระบบประมวลผลข้อมูล")
txtFind.Text = ""
End If
End If
' Name
If rdoNAME.Checked = True Then
OpenDB()
CN.Open()
Found = False
keysearch = txtFind.Text
For k As Integer = 0 To DS.Tables(0).Rows.Count - 1
If UCase(keysearch) = UCase(DS.Tables(0).Rows(k)("firstname")) Then
i = k
Found = True
Exit For
End If
Next k
If Found = False Then
MsgBox("ไม่มีชื่อนี้อยู่ในฐานข้อมูล", MsgBoxStyle.Exclamation, "ระบบประมวลผลข้อมูล")
txtFind.Text = ""
End If
End If
' SureName
If rdoSurename.Checked = True Then
OpenDB()
CN.Open()
Found = False
keysearch = txtFind.Text
For k As Integer = 0 To DS.Tables(0).Rows.Count - 1
If UCase(keysearch) = UCase(DS.Tables(0).Rows(k)("surename")) Then ตรงบรรทัดนี้ค่ะ
i = k
Found = True
Exit For
End If
Next k
If Found = False Then
MsgBox("ไม่มีนามสกุลชื่อนี้อยู่ในฐานข้อมูล", MsgBoxStyle.Exclamation, "ระบบประมวลผลข้อมูล")
txtFind.Text = ""
End If
End If
If Found = True Then
Call DataShow()
Call DefaulSearch()
btnEdit.Visible = True
End If
CN.Close()
End Sub