I seem to be having a little trouble connecting to my subdomain's database. (It's a subdomain, I'm using space off of a friend's domain name) When I look at my database's port # it just says localhost (which should be correct because it's located on the same server).
I have a VB.net project, however, that cannot connect. (my friend has given me a few port #s that I might be able to use to connect, but they are not correct.) This is the code I'm using:
MySQLConnection = New MySqlConnection
MySQLConnection.ConnectionString = "server=***.***.com;Port=***; User ID=*****; password=*****; database=*****;"
MySQLConnection.Open()
Dim MyAdapter As New MySqlDataAdapter
Dim SqlQuary = "SELECT VersionNumber From GameStats;"
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
While Mydata.Read()
If Mydata(0).ToString = Label2.Text Then
LinkLabel1.Text = ""
Else
Button1.Enabled = False
Button2.Enabled = False
LinkLabel1.Text = "Update to Version:" & Mydata(0).ToString
End If
End While
End If
Mydata.Close()
Can anyone point me in the right direction as how I can connect to a "localhost" on a server that isn't mine? I saw somewhere on some website (I could be totally wrong, I was up late that night and was running on 2 hours of sleep) that the website administrator had to change some configuration setting in his control panel (he is using cPanel) to allow me to access the database. Any help?