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?

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.

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?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.