我正在編寫我的第一個在MySql數據庫上運行的Windows 10通用應用程序。我使用的代碼與本指南(這是爲Windows 8 Store應用程序):如何將W10通用應用程序與MySQL數據庫連接
https://blogs.oracle.com/MySqlOnWindows/entry/how_to_using_connector_net
但是當我嘗試打開我的數據庫連接,我得到錯誤:
An exception of type 'System.NotImplementedException' occurred in >MySql.Data.RT.dll but was not handled in user code
Additional information: SSL not supported in this WinRT release.
public class DBconnector
{
static string server = "127.0.0.1";
static string database = "hurtownia";
static string user = "root";
static string pswd = "root";
public static bool login(string email, string password)
{
string connectionString = "Server = " + server + ";database = " + database + ";uid = " + user + ";password = " + pswd + ";";
using (MySqlConnection connection = new MySqlConnection(connectionString))
{
connection.Open();
MySqlCommand checkLogin = new MySqlCommand("select password_hash, password_salt from users where email = \""+email+"\"",connection);
using (MySqlDataReader reader = checkLogin.ExecuteReader())
{
reader.Read();
string hash = reader.GetString("password_hash");
string salt = reader.GetString("password_salt");
bool result = passwordGenerator.compare(password, hash, salt);
if (result)
return true;
else
return false;
}
}
}
}
所以,我的問題是如何解決這個問題,並正確連接到Windows 10通用應用程序中的MySql數據庫。
你檢查過了嗎? http://stackoverflow.com/questions/22462441/connect-windows-8-app-to-mysql –