10
votes

Comment puis-je me connecter à MySQL des formulaires Windows?

Comment puis-je me connecter à une base de données MySQL à partir de formulaires Windows?


0 commentaires

4 Réponses :


3
votes

Utilisez le connecteur d'ici . Il y a un Documentation aussi.


0 commentaires

1
votes

ici est un article complet sur la connexion à MySQL en utilisant connecteur / NET 6.0 .

Vous pouvez également utiliser OLEDB pour se connecter à MySQL.


0 commentaires

7
votes

nombreux échantillons de chaînes de connexion ici: http://www.connectionstrings.com/


1 commentaires

merci mec..it est vraiment superb.im lovin ça !!



0
votes
private void button1_Click(object sender, System.EventArgs e)
{
    string MyConString = "SERVER=localhost;" +"DATABASE=mydatabase;" 
        "UID=testuser;" +"PASSWORD=testpassword;";
    MySqlConnection connection = new MySqlConnection(MyConString);
    MySqlCommand command = connection.CreateCommand();
    MySqlDataReader Reader;
    command.CommandText = "select * from mycustomers";
    connection.Open();
    Reader = command.ExecuteReader();
    while (Reader.Read())
    {
        string thisrow = "";                
        for (int i = 0;i<Reader.FieldCount;i++)     
            thisrow += Reader.GetValue(i).ToString() + ","; 
        listBox1.Items.Add(thisrow);
    }
    connection.Close(); 
}
i think this gonna be the simple one right!!!
but thanx all of u guys for responding and providing me the documentation!

0 commentaires