0

I am having a small problem... I can connect to a local MySql Database using:

SQLConn.ConnectionString = "Data Source=servername;" & _
"Initial Catalog=databasename;" & _
"User ID=username;" & _
"Password=userpassword;"

Where servername is "localhost". I need to make a connection to an online database (same data structure). What should I put at the servername in that case? I do have all the info about the database in question (Domain, Ip, etc...). Which part should i use?

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by xcorpionxting
0

I am having a small problem... I can connect to a local MySql Database using:

SQLConn.ConnectionString = "Data Source=servername;" & _
"Initial Catalog=databasename;" & _
"User ID=username;" & _
"Password=userpassword;"

Where servername is "localhost". I need to make a connection to an online database (same data structure). What should I put at the servername in that case? I do have all the info about the database in question (Domain, Ip, etc...). Which part should i use?

Hi xcorpionxting ,
The above syntax can be used to connect with SQL Server. Are you able to connect with MySQL using this syntax?

What type of object is SQLConn?

If it is System.Data.SqlClient.SqlConnection, you cannot use it to connect with MySQL database.

You need to use following providers to connect with MySQL.
MySQL Connector/Net (MySqlConnection)
.NET Framework Data Provider for OLE DB (OleDbConnection)
.NET Framework Data Provider for ODBC (OdbcConnection)
Any third party ADO.NET provider for MySQL

For connection strings on MySQL, visit this link.

0

Yes, I can already connect and manipulate a local MySQL database perfectly. The above code is a mere snippet, my full code imports all the needed references and has all the try-catrch procedures needed. I just need to convert it to connect to an online database. Help?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.