You cannot have like:
If Mydata(0).Read = Label2.Text Then This does nothing. Read is a method, and not a property.
SqlDataReader class cannot be compared with some string.
What you can do, is to compare an actual reader with it, like:
If Mydata(0).Read() = Label2.Text Then
Button5.Enabled = False
LinkLabel1.Text = "YOU NEED TO UPDATE!"
End If
you can alseo try it in a long way:
If Mydata.HasRows = 0 Then
Interaction.MsgBox("Could not connect with database. Check firewall and/or try again at a later time.")
Else
If Mydata().Read() Then
If DirectCast(MyData(0), String) = Label2.Text Then
Button5.Enabled = False
LinkLabel1.Text = "YOU NEED TO UPDATE!"
Exit
Else
LinkLabel1.Text = ""
End If
Else
LinkLabel1.Text = ""
End If
End If Mitja Bonca
Nearly a Posting Maven
2,485 posts since May 2009
Reputation Points: 641
Solved Threads: 474