PDA

View Full Version : حرفه ای: خطا در اتصال c# -->mysql



morteza_carefree
چهارشنبه 26 مهر 1391, 16:27 عصر
سلام دوستان من با کد زیر میخوام وصل بشم ولی این خطا رو میده

Unable to connect to any of the specified MySQL hosts.


private MySqlConnection connection;
private string server;
private string database;
private string uid;
private string password;
public Form1()
{
InitializeComponent();
server = "176.10.147.120";
database = "apir_azm";
uid = "apir_azm";
password = "6!O6x-]+Bb";
string connectionString;
connectionString = "SERVER=" + server + ";" + "DATABASE=" +
database + ";" + "UID=" + uid + ";" + "PASSWORD=" + password + ";";

connection = new MySqlConnection(connectionString);
}

private void connect_Click(object sender, EventArgs e)
{
Application.DoEvents();
connection.Open();
string q = "SELECT * FROM `test` ";
MySqlCommand cmd = new MySqlCommand(q, connection);
MySqlDataAdapter da = new MySqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.SelectCommand.ExecuteNonQuery();
da.Fill(ds, "t");
DGW.DataSource = ds;
DGW.DataMember = "t";
}

morteza_carefree
پنج شنبه 04 آبان 1391, 11:47 صبح
تورو خدا یکی کمک کنه کل پروژه به خاطر این مونده