更新时间:2023-02-05 12:35:57
您需要返回类型为MySqlConnection
的对象.在这种情况下,它应该是con
.
You need to return an object of typeMySqlConnection
. In this case that would becon
.
该方法必须返回一个MySqlConnection
对象. 大概
That method must return aMySqlConnection
object.
Probably
return con;
只需在大括号前即可解决问题.
:rolleyes:
just before the closing curly bracket will do the trick.
:rolleyes:
问题是,您没有返回MySqlConnection.您可以做的是:
the problem is, that you are not returning a MySqlConnection. What you could do is:
public static MySqlConnection m_con;
public static MySqlConnection GetConnection(string server, string user, string password, string db)
{
string str = "Server='" + server + "';user='" + user + "';password='" + password + "';database='" + db + "';";
m_con = new MySqlConnection(str);
con.Open();
isConnected = true;
return m_con;
}