string str = "server= xxx.xxx.xxx.xxx;Initial Catalog= hgjhg;User Id=root;Password= jhgjhg@123";
MySqlConnection connection = new MySqlConnection();
我无法访问下面语句中的 str obj 进行连接,为什么?
最佳答案
来自 MySqlConnection 的文档这些示例表明您需要将连接字符串传递给构造函数:
string connStr = "server=localhost;user=root;database=world;port=3306;password=******";
MySqlConnection conn = new MySqlConnection(connStr);
关于c# - 我无法访问下面语句中的字符串对象来连接。为什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50251422/