L
luna
need to display a label if a record is not found - tried a few things but it
appears to be ignoring me!!
code is currently like this - you can also see the test i did - must be
doing something obviously wrong
(its friday..)
cheers mark
Dim sql As String = "Select * from Personal where Personal.ID=" &
userid.Text.ToString
Dim conn As New System.Data.SqlClient.SqlConnection(strConn)
Dim Cmd As New System.Data.SqlClient.SqlCommand(sql, conn)
Dim objDR As System.Data.sqlclient.SqlDataReader
conn.Open()
objDR = Cmd.ExecuteReader(System.Data.CommandBehavior.CloseConnection)
While objDR.Read()
'If Not objDR.IsDBNull(0) Then
'exist.Text = "No Records Found"
'Else : exist.Text = objDR("ID")
'End If
exist.Text = objDR("ID")
If exist.Text.ToString = "" Then
exist.Text = "No Records Found"
End If
If objDR.IsDBNull(1) Then
surname1.Text = ""
Else : surname1.Text = objDR("surname1")
End If
---rest of code---
appears to be ignoring me!!
code is currently like this - you can also see the test i did - must be
doing something obviously wrong
(its friday..)
cheers mark
Dim sql As String = "Select * from Personal where Personal.ID=" &
userid.Text.ToString
Dim conn As New System.Data.SqlClient.SqlConnection(strConn)
Dim Cmd As New System.Data.SqlClient.SqlCommand(sql, conn)
Dim objDR As System.Data.sqlclient.SqlDataReader
conn.Open()
objDR = Cmd.ExecuteReader(System.Data.CommandBehavior.CloseConnection)
While objDR.Read()
'If Not objDR.IsDBNull(0) Then
'exist.Text = "No Records Found"
'Else : exist.Text = objDR("ID")
'End If
exist.Text = objDR("ID")
If exist.Text.ToString = "" Then
exist.Text = "No Records Found"
End If
If objDR.IsDBNull(1) Then
surname1.Text = ""
Else : surname1.Text = objDR("surname1")
End If
---rest of code---