スマートデバイスプロジェクトは初めてです。MySQL ConnectorNet6.4.4をインストールしました。そして、2008年のmysql接続用にMySql.Data.CFを追加します。
しかし、出力を取得できません。指定されたMySQLホストのいずれにも接続できません。」connection.open()での例外。
server=192.168.1.100;User Id=mcubic;Persist Security Info=True;database=mcubic
その有効な接続文字列。したがって、データベースサーバーのユーザーID、パスワードは正しいです。その問題はありません。しかし、スマートデバイスプロジェクトだけでエラーが発生した理由がわかりません。
以下のコード。
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);
}
エラーを見つけるのを手伝ってください。
以下の接続文字列を試しました。
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;
しかし、役に立たない。