Hey guys, I've looked around the forum and seen a few answers that looked like it should have solved the problem - but didn't. I'm trying to create a function that will check the database and compare it with the value of my label. (Basically a Version Checker) If it is the same, then nothing is displayed, if not, then I'll disable some buttons and change another text to display something. Here's the code I have so far...
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Panel2.Visible = False Panel1.Visible = False Panel4.Visible = False MySQLConnection = New MySqlConnection MySQLConnection.ConnectionString = "server=db4free.net;Port=3306; User ID=*****; password=*****; database=*****;" 'The problem isn't this ;) MySQLConnection.Open() Dim MyAdapter As New MySqlDataAdapter Dim SqlQuary = "SELECT VersionNumber From Table32;" Dim Command As New MySqlCommand Command.Connection = MySQLConnection Command.CommandText = SqlQuary MyAdapter.SelectCommand = Command Dim Mydata As MySqlDataReader Mydata = Command.ExecuteReader If Mydata.HasRows = 0 Then MsgBox("Could not connect with database. Check firewall and/or try again at a later time.") Else If Mydata(0).Read = Label2.Text Then Button5.Enabled = False LinkLabel1.Text = "YOU NEED TO UPDATE!" Else LinkLabel1.Text = "" End If End If Mydata.Close() End Sub
I'm positive that I'm just not putting the correct calling reference in this part:
If Mydata(0).Read = Label2.Text Then
If anyone could shed some light on the subject, I'd appreciate it! Thanks!
Edited 5 Years Ago by maggoteer: n/a