[英]Can't connect to MySql database on web hosting using C# Windows application?
I'm trying to connect on some web hosting using C# Windows application, but unsuccessfuly. 我正在尝试使用C#Windows应用程序连接某些虚拟主机,但未成功。
I use this con string: 我使用这个con字符串:
Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword;
I'm sure that values in con string are ok, because i have used this values in php connect script. 我确定con字符串中的值是可以的,因为我已经在php connect脚本中使用了此值。
Here is the test code: 这是测试代码:
string conString = "Server=localhost;Database=********;Uid=********;Pwd=********;";
MySqlConnection con = new MySqlConnection(conString);
try
{
con.Open();
MessageBox.Show("Connected!");
}
catch (MySqlException mex)
{
MessageBox.Show(mex.Message);
con.Close();
}
I have MySql connector installed, i have tried another port 3307, but unsuccessfully. 我安装了MySql连接器,尝试了另一个端口3307,但未成功。
From here i used values in connection string: 从这里我在连接字符串中使用了值:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.