I am trying to connect to my remote MySQL server, using the following code. Can you tell me what I am doing wrong as the replacement of database connection info with variables doesn't seem to be working.
using MySql.Data.MySqlClient;
string db_Server = "10.0.0.0";
string db_Name = "myDatabase";
string db_User = "myUser";
string db_Pass = "myPassword";
// Connection String
MySqlConnection myConnection = new MySqlConnection("server = {0}; database = {1}; uid = {2}; pwd = {3}", db_server, db_Name, db_User, db_Pass);
As a PHP developer, I prefer to use the code above instead of the deliberate casting below:
MySqlConnection myConnection = new MySqlConnection("server=10.0.0.0; database=myDatabase; uid=myUser; pwd=myPassword");
But as you can see in this image, I am getting a lot of red squiggles: http://screencast.com/t/xlwoG9by
db_Server, db_Name, db_User, db_Passnotdb_Server, db_User, db_Pass, db_Name