2012-01-23 35 views
0

我是SmartDeviceProject的新手。所以當我嘗試連接MySQL到我的項目,MissingManifestResourceException通過在Connection.open在下面的代碼?通過SmartDeviceProject MissingManifestResourceException?

string connectionString = "server=192.168.1.100;database=mcubic;User Name=mcubic;[email protected]$;"; 
      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(); 

我該如何解決這個問題。我爲這個項目導入了MySql.Data.CF.dll。

回答

0

通過Krish卡帕迪亞從MSDN論壇:

解決方案:

  1. MySQL的5.2.7.0版本是穩定版本。我使用這個版本的DLL。其他版本有很多問題。所以首先我從mysql站點下載該版本的dll。 這裏是鏈接:

http://dev.mysql.com/downloads/connector/net/5.2.html

  1. 我已插入「mysql.user」表中的一個條目,其中主機將是「%」(指任何用戶都可以連接到MySQL)。如果你不想插入帶有主機名的條目,那麼你必須插入所有應該被允許連接到mysql的IP地址。

  2. 在'mysql.user'中插入條目後,我重新啓動了MySQL服務。

  3. 然後嘗試連接到MySQL及關連....

來源: http://social.msdn.microsoft.com/Forums/eu/netfxcompact/thread/66f6386a-9963-4c2f-8d39-1c507a26a6c7

+0

沒有用的,先生。沒有找到mysql.data.cf.dll。 – Sagotharan