C#将Mysql Variable发送到另一个表单

时间:2017-10-20 15:53:51

标签: c# mysql variables send

我尝试将MYSQL变量发送到Form2时出现问题,如

  MySqlConnection open = new MySqlConnection("Server=localhost;User=root;Password=123456789;database=on-line;pooling='true'; Max Pool Size = 100000");
        open.Open();


        MySqlCommand checker = new MySqlCommand("Select * From users where Mail = '" + TextMail.text.ToString() + "' ", open);
        MySqlDataReader MysqlReader = checker.ExecuteReader();


        if (MysqlReader.Read())
        {
            name = MysqlReader["Name"].ToString();
        }
        else
        {


        }

        Form2 form2 = new Form2();
        form2.textbox1.text = name;

表格2

 string get = textbox1.text;
        MySqlConnection open = new MySqlConnection("Server=localhost;User=root;Password=123456789;database=on-line;pooling='true'; Max Pool Size = 100000");
        open.Open();


        MySqlCommand checker = new MySqlCommand("Select * From users where Mail = '" + get.ToString() + "' ", open);
        MySqlDataReader MysqlReader = checker.ExecuteReader();


        if (MysqlReader.Read())
        {
        }
        else
        {


        }

我正在尝试连接到我的数据库,但它无法工作......我们有任何解决方案,如.NET上的会话

0 个答案:

没有答案