C# MySQL.data登录错误

C# MySQL.data登录错误,c#,mysql,mysql.data,C#,Mysql,Mysql.data,好的,我想做一个加载器,通过修改internet上的源代码,将dll注入基于从MySQL数据库检查的hwid的进程,然而,即使我键入了正确的登录凭据,它也会给我一个错误,即用户名或密码无效,即使它们都是正确的 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using Sy

好的,我想做一个加载器,通过修改internet上的源代码,将dll注入基于从MySQL数据库检查的hwid的进程,然而,即使我键入了正确的登录凭据,它也会给我一个错误,即用户名或密码无效,即使它们都是正确的

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using ManualMapInjection.Injection;
using System.Net;
using System.IO;
using System.Diagnostics;
using MySql.Data.MySqlClient;

namespace WindowsFormsApp2
{
    public partial class Form1 : Form
    {
        private MySqlConnection conn;
        string HWID;
        public Form1()
        {
            HWID = System.Security.Principal.WindowsIdentity.GetCurrent().User.Value;
            string connString;
            connString = $"SERVER=sql7.freemysqlhosting.net;PORT=3306;DATABASE=sql2345678;UID=loader;PASSWORD=password1234";
            conn = new MySqlConnection(connString);
            InitializeComponent();
        }


        public bool IsLogin()
        {
            string trruu = "TRUE";
            string query = $"SELECT * FROM loader WHERE hwid='{HWID}' AND active_subscription='{trruu}';";

            try
            {
                if (OpenConnection())
                {
                    MySqlCommand cmd = new MySqlCommand(query, conn);
                    MySqlDataReader reader = cmd.ExecuteReader();

                    if (reader.Read())
                    {
                        MessageBox.Show("Logged In");
                        reader.Close();
                        conn.Close();
                        return true;
                    }
                    else
                    {
                        MessageBox.Show("Error Logging In");
                        reader.Close();
                        conn.Close();
                        return false;
                    }
                }
                else
                {
                    MessageBox.Show("Error Logging In");
                    conn.Close();
                    return false;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error");
                conn.Close();
                return false;
            }
        }

        private bool OpenConnection()
        {
            try
            {
                conn.Open();
                return true;
            }
            catch (MySqlException ex)
            {
                MessageBox.Show("Server username or password is incorrect! " + ex.Number);
                return false;
            }
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            HWID = System.Security.Principal.WindowsIdentity.GetCurrent().User.Value;
            textBox1.Text = HWID;
            textBox1.ReadOnly = true;
            checkonline();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            checkonline();
            WebClient wb = new WebClient();
            if (IsLogin()) 
            {
                string mainpath = "C:\\Windows\\random.dll";
                wb.DownloadFile("MY DIRECT DOWNLOADLINK URL", mainpath);
                var name = "process";
                var target = Process.GetProcessesByName(name).FirstOrDefault();
                var path = mainpath;
                var file = File.ReadAllBytes(path);

                //Checking if the DLL isn't found
                if (!File.Exists(path))
                {
                    MessageBox.Show("Error: DLL not found");
                    return;
                }

                //Injection
                var injector = new ManualMapInjector(target) { AsyncInjection = true };
                label2.Text = $"hmodule = 0x{injector.Inject(file).ToInt64():x8}";

                if (System.IO.File.Exists(mainpath))
                {
                    System.IO.File.Delete(mainpath);
                }
            }
            else
            {
                MessageBox.Show("HWID Incorrect");
            }
        }

哦,那个查询字符串。。。。小Bobby Tables会在他的坟墓里翻身。数据库名为“loader”吗?我的意思是数据库名与表名相同吗?哎呀,代码是错误的,我更新了它(另一个也不起作用)@john是数据库的样子不清楚你的错误到底在哪里。并非所有的
MySqlException
s都表示登录失败。失败的确切代码行是什么?如果出现异常,完整的异常详细信息是什么?