1

我一直在寻找类似的问题,并查看了大多数类似的问题,但没有一个答案是有用的......

我收到此错误:

可访问性不一致:参数类型“FinalProject.MySQL”比方法“FinalProject.Form2.Form2(FinalProject.MySQL)”更难访问

namespace FinalProject
{
    public partial class Form2 : Form
    {
        MySqlConnection c;
        public Form2(MySqlConnection connection) //this is the line of the error.
        {
            InitializeComponent();
            c = connection;
        }

        private void okBtn_Click(object sender, EventArgs e)
        {
            if (c.State == ConnectionState.Open)
            {
                textBox1.Text += "conection open";
            }
        }
    }
}

namespace FinalProject
{
    public class MySQL
    {
        public MySqlConnection connection;
        private string server;
        private string port;
        private string database;
        private string uid;
        private string password;

        //Constructor
        public MySQL()
        {
            Initialize();
        }

        //Initialize values
        private void Initialize()
        {
      .
      .
      .

我试图将“公共”修饰符放在我能想到的所有东西上……不走运:)))

4

0 回答 0