Universal App MySQLConnector Queue 执行错误
Universal App MySQLConnector Queue execution error
我尝试使用 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 有和没有;同样的例外。在服务器上,队列工作正常。
问题:
队列错误还是我忘记了服务器上的配置?
问题是,我忘记为命令设置连接
connection.Open();
MySqlCommand checkLogin = new MySqlCommand("SELECT * FROM `UserData`",connection);
添加连接后,一切正常。
我尝试使用 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 有和没有;同样的例外。在服务器上,队列工作正常。
问题: 队列错误还是我忘记了服务器上的配置?
问题是,我忘记为命令设置连接
connection.Open();
MySqlCommand checkLogin = new MySqlCommand("SELECT * FROM `UserData`",connection);
添加连接后,一切正常。