【问题标题】:Universal App MySQLConnector Queue execution errorUniversal App MySQLConnector 队列执行错误
【发布时间】:2016-03-19 23:22:22
【问题描述】:

我尝试使用 PHPAdmin 在我的虚拟服务器上执行一个队列到我的数据库,我得到了

例外:

代码:

        static string server = "999.999.999.235";
    static string database = "admin_";
    static string user = "root";
    static string pswd = "secret";

    public static void login()
    {
        string connectionString = "Server = " + server + ";database 
        = "+ database + ";uid = " + user + ";password = " + pswd + ";" + "SslMode=None;" + "CharSet=utf8;";
        using (MySqlConnection connection = new 

    MySqlConnection(connectionString))
        {
            connection.Open();
            MySqlCommand checkLogin = new MySqlCommand("SELECT * FROM `UserData`;");
            using (MySqlDataReader reader = checkLogin.ExecuteReader())
            {
                reader.Read();
                string hash = reader.GetString("UserName");
                string salt = reader.GetString("Workbench");

异常被抛出:

MySqlCommand checkLogin = new MySqlCommand("SELECT * FROM UserData;");

我尝试了 UserData 和 UserData 有和没有 ;同样的例外。在服务器上,队列工作正常。

问题: 是队列错误还是我忘记了服务器上的配置?

【问题讨论】:

标签: c# mysql win-universal-app mysql-connector


【解决方案1】:

问题是,我忘记为命令设置连接

connection.Open();
MySqlCommand checkLogin = new MySqlCommand("SELECT * FROM `UserData`",connection);

添加连接后,一切正常。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-07-21
    • 2019-02-25
    • 1970-01-01
    • 1970-01-01
    • 2021-11-14
    • 1970-01-01
    • 2018-10-18
    相关资源
    最近更新 更多