Connecting to Online MySQL Database
I got this Database that is Online thats hosted through the Website and uses MySQL, and the Tables have some Data I like to Read From. Heres what I got (I used Jim's Data Read Thread)
vb Code:
Public Sub testconnect()
Dim sqlconn As String = "Server=63.247.93.106;Database=viina_schoolbook;User=---; Password=---;"
Using Connection2 As New SqlConnection(sqlconn)
Using commanda As New SqlCommand("SELECT Keys From viina_schoolbook", Connection2)
Connection2.Open()
Using reader2 As SqlDataReader = commanda.ExecuteReader()
While reader2.Read()
MsgBox(reader2("keys"))
End While
End Using
End Using
End Using
End Sub
When I tried doing this as the SQL Connection String:
Driver={MySQL ODBC 3.51 Driver};Server=data.domain.com;Database=myDataBase;User=myUsername; Password=myPassword;Option=3;
I got an Error saying Driver is Invalid.
Re: Connecting to Online MySQL Database
Here's a quote from the first paragraph in that thread of mine:
Quote:
This code uses members of the System.Data.SqlClient namespace. If you're not using SQL Server then it's a simple matter of switching to the corresponding types of the appropriate namespace for your data source. For example, if you're using an Access database then you'd use an OleDb.OleDbConnection rather than an SqlClient.SqlConnection.
You're not using SQL Server so you can't use the members of SqlClient. You're using an ODBC connection string for MySQL so you would need to use members of the System.Data.Odbc namespace with it.
That said, I'd tend to recommend OleDb over Odbc and a MySQL-specific connector over OleDb. You can download one from the MySQL web site. Note that each different connector requires a different connection string format.
Re: Connecting to Online MySQL Database
Have you installed the Driver on your server? If not, you can get the ODCB from MySQL.com
http://dev.mysql.com/downloads/conne...5.1.html#win32
Re: Connecting to Online MySQL Database
Hey
If you are wanting to use the MySqlCommand, MySqlConnection objects etc, I think I am right in saying that you are going to need to install the Connector/Net, which you can download from here:
http://dev.mysql.com/downloads/connector/net/5.2.html
And you can find examples usage of this both here:
http://dev.mysql.com/doc/refman/5.0/...qlcommand.html
And here:
http://www.vbmysql.com/articles/vbnet-mysql-tutorials
Hope this helps!!
Gary