I am new to Smart Device Projects. I installed MySQL Connector Net 6.4.4. And i add MySql.Data.CF for mysql connection in vs 2008.
But i can't get the output. "Unable to connect to any of the specified MySQL hosts." exception through on the connection.open().
server=192.168.1.100;User Id=mcubic;Persist Security Info=True;database=mcubic
its a working Connection string. So database server user id, password are correct. No issue in that. But i can't understand why it through error on Smart Device Projects only.
The code given below.
try
{
string connectionString = "server=192.168.1.100;User Id=mcubic;Persist Security Info=True;database=mcubic";
string query = "select b.Outlet_Master_Name from mcs_user_outlet a,outlet_master b where a.Mcs_User_Outlet_User_Id=3 and a.Mcs_User_Outlet_Outlet_Id = b.Outlet_Master_Id";
MySqlConnection connection = new MySqlConnection(connectionString);
MySqlCommand command = new MySqlCommand(query, connection);
connection.Open();
MySqlDataReader Reader = command.ExecuteReader();
while (Reader.Read())
{
comboBox1.Items.Add(Reader[0].ToString());
}
connection.Close();
}
catch(Exception ex)
{
MessageBox.Show(""+ex.Message);
}
Help me to find out the error.
I have tried below Connection Strings.
server=192.168.1.100;UID=mcubic;Persist Security Info=True;database=mcubic
server=192.168.1.100;User Id=mcubic;Persist Security Info=False;database=mcubic
server=192.168.1.100;User Id=mcubic;Persist Security Info=False;Initial Catalog=mcubic;
server=192.168.1.100;UID=mcubic;Persist Security Info=True;database=mcubic;pooling = false;
But No Use.