Hello. I have a hosting plan and they provide me MySQL database with phpmyadmin.
I want to connect to this database using Visual Basic 2010 VB.net
Here is the code:
But I always get the following error:
[DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied.
I have added my ip address in the Cpanel MySQL remote but this didnt help.
My questions are:
1. What is the source of problem: my code, or the hosting plan provider that blocks my computer?
2. If they block my ip, then what is the best way to develop a program that works with a database? which database to use, that will allow the program to connect from any computer (anywhere in the world)?
Thanks!
I want to connect to this database using Visual Basic 2010 VB.net
Here is the code:
Code:
Public Sub ReadMyData(ByVal connectionString As String)
Dim queryString As String = "SELECT OrderID, CustomerID FROM Orders"
Using connection As New OleDbConnection(connectionString)
Dim command As New OleDbCommand(queryString, connection)
connection.Open()
Dim reader As OleDbDataReader = command.ExecuteReader()
While reader.Read()
Console.WriteLine(reader.GetInt32(0).ToString() + ", " _
+ reader.GetString(1))
End While
' always call Close when done reading.
reader.Close()
End Using
End Sub
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click ReadMyData("provider=SQLOLEDB;Server=xxx.xxx.xx.xx;Database=dbname;Uid=user_test;Pwd=pass;")
End Sub[DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied.
I have added my ip address in the Cpanel MySQL remote but this didnt help.
My questions are:
1. What is the source of problem: my code, or the hosting plan provider that blocks my computer?
2. If they block my ip, then what is the best way to develop a program that works with a database? which database to use, that will allow the program to connect from any computer (anywhere in the world)?
Thanks!